'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 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
    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))
        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.iteritems():
            summary_name = ('eval/' + name)
            tf.summary.scalar(summary_name, tf.Print(value, [value], summary_name))
        return names_to_updates.values()
