MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / summary_writer_function

Function summary_writer_function

tensorflow/python/ops/summary_ops_v2.py:704–733  ·  view source on GitHub ↗

Helper function to write summaries. Args: name: name of the summary tensor: main tensor to form the summary function: function taking a tag and a scope which writes the summary family: optional, the summary's family Returns: The result of writing the summary.

(name, tensor, function, family=None)

Source from the content-addressed store, hash-verified

702
703
704def summary_writer_function(name, tensor, function, family=None):
705 """Helper function to write summaries.
706
707 Args:
708 name: name of the summary
709 tensor: main tensor to form the summary
710 function: function taking a tag and a scope which writes the summary
711 family: optional, the summary's family
712
713 Returns:
714 The result of writing the summary.
715 """
716 name_scope = ops.get_name_scope()
717 if name_scope:
718 # Add a slash to allow reentering the name scope.
719 name_scope += "/"
720 def record():
721 with ops.name_scope(name_scope), summary_op_util.summary_scope(
722 name, family, values=[tensor]) as (tag, scope):
723 with ops.control_dependencies([function(tag, scope)]):
724 return constant_op.constant(True)
725
726 if context.context().summary_writer is None:
727 return control_flow_ops.no_op()
728 with ops.device("cpu:0"):
729 op = smart_cond.smart_cond(
730 should_record_summaries(), record, _nothing, name="")
731 if not context.executing_eagerly():
732 ops.add_to_collection(ops.GraphKeys._SUMMARY_COLLECTION, op) # pylint: disable=protected-access
733 return op
734
735
736def generic(name, tensor, metadata=None, family=None, step=None):

Callers 5

genericFunction · 0.85
scalarFunction · 0.85
histogramFunction · 0.85
imageFunction · 0.85
audioFunction · 0.85

Calls 6

should_record_summariesFunction · 0.85
get_name_scopeMethod · 0.80
executing_eagerlyMethod · 0.80
add_to_collectionMethod · 0.80
contextMethod · 0.45
deviceMethod · 0.45

Tested by

no test coverage detected