(self, data, endpoints, charset, is_training)
Creates all summaries for the model.

    Args:
      data: InputEndpoints namedtuple.
      endpoints: OutputEndpoints namedtuple.
      charset: A dictionary with mapping between character codes and
        unicode characters. Use the one provided by a dataset.charset.
      is_training: If True will create summary prefixes for training job,
        otherwise - for evaluation.

    Returns:
      A list of evaluation ops
Creates all summaries for the model.
Creates all summaries for the model .
def create_summaries(self, data, endpoints, charset, is_training):
    """Creates all summaries for the model.

    Args:
      data: InputEndpoints namedtuple.
      endpoints: OutputEndpoints namedtuple.
      charset: A dictionary with mapping between character codes and
        unicode characters. Use the one provided by a dataset.charset.
      is_training: If True will create summary prefixes for training job,
        otherwise - for evaluation.

    Returns:
      A list of evaluation ops
    """

    def sname(label):
      prefix = 'train' if is_training else 'eval'
      return '%s/%s' % (prefix, label)

    max_outputs = 4
    # TODO(gorban): uncomment, when tf.summary.text released.
    charset_mapper = CharsetMapper(charset)
    pr_text = charset_mapper.get_text(
    endpoints.predicted_chars[:max_outputs,:])
    tf.summary.text(sname('text/pr'), pr_text)
    gt_text = charset_mapper.get_text(data.labels[:max_outputs,:])
    tf.summary.text(sname('text/gt'), gt_text)
    tf.summary.image(sname('image'), data.images, max_outputs=max_outputs)

    if is_training:
      tf.summary.image(
        sname('image/orig'), data.images_orig, max_outputs=max_outputs)
      for var in tf.trainable_variables():
        tf.summary.histogram(var.op.name, var)
      return None

    else:
      names_to_values = {}
      names_to_updates = {}

      def use_metric(name, value_update_tuple):
        names_to_values[name] = value_update_tuple[0]
        names_to_updates[name] = value_update_tuple[1]

      use_metric('CharacterAccuracy',
                 metrics.char_accuracy(
                   endpoints.predicted_chars,
                   data.labels,
                   streaming=True,
                   rej_char=self._params.null_code))
      # Sequence accuracy computed by cutting sequence at the first null char
      use_metric('SequenceAccuracy',
                 metrics.sequence_accuracy(
                   endpoints.predicted_chars,
                   data.labels,
                   streaming=True,
                   rej_char=self._params.null_code))

      for name, value in names_to_values.items():
        summary_name = 'eval/' + name
        tf.summary.scalar(summary_name, tf.Print(value, [value], summary_name))
      return list(names_to_updates.values())
def create_summaries ( self , data , endpoints , charset , is_training ) : def sname ( label ) : prefix = 'train' if is_training else 'eval' return '%s/%s' % ( prefix , label ) max_outputs = 4 # TODO(gorban): uncomment, when tf.summary.text released. charset_mapper = CharsetMapper ( charset ) pr_text = charset_mapper . get_text ( endpoints . predicted_chars [ : max_outputs , : ] ) tf . summary . text ( sname ( 'text/pr' ) , pr_text ) gt_text = charset_mapper . get_text ( data . labels [ : max_outputs , : ] ) tf . summary . text ( sname ( 'text/gt' ) , gt_text ) tf . summary . image ( sname ( 'image' ) , data . images , max_outputs = max_outputs ) if is_training : tf . summary . image ( sname ( 'image/orig' ) , data . images_orig , max_outputs = max_outputs ) for var in tf . trainable_variables ( ) : tf . summary . histogram ( var . op . name , var ) return None else : names_to_values = { } names_to_updates = { } def use_metric ( name , value_update_tuple ) : names_to_values [ name ] = value_update_tuple [ 0 ] names_to_updates [ name ] = value_update_tuple [ 1 ] use_metric ( 'CharacterAccuracy' , metrics . char_accuracy ( endpoints . predicted_chars , data . labels , streaming = True , rej_char = self . _params . null_code ) ) # Sequence accuracy computed by cutting sequence at the first null char use_metric ( 'SequenceAccuracy' , metrics . sequence_accuracy ( endpoints . predicted_chars , data . labels , streaming = True , rej_char = self . _params . null_code ) ) for name , value in names_to_values . items ( ) : summary_name = 'eval/' + name tf . summary . scalar ( summary_name , tf . Print ( value , [ value ] , summary_name ) ) return list ( names_to_updates . values ( ) )