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

Function record_if

tensorflow/python/ops/summary_ops_v2.py:102–121  ·  view source on GitHub ↗

Sets summary recording on or off per the provided boolean value. The provided value can be a python boolean, a scalar boolean Tensor, or or a callable providing such a value; if a callable is passed it will be invoked on-demand to determine whether summary writing will occur. Args: con

(condition)

Source from the content-addressed store, hash-verified

100@tf_export("summary.record_if", v1=[])
101@tf_contextlib.contextmanager
102def record_if(condition):
103 """Sets summary recording on or off per the provided boolean value.
104
105 The provided value can be a python boolean, a scalar boolean Tensor, or
106 or a callable providing such a value; if a callable is passed it will be
107 invoked on-demand to determine whether summary writing will occur.
108
109 Args:
110 condition: can be True, False, a bool Tensor, or a callable providing such.
111
112 Yields:
113 Returns a context manager that sets this value on enter and restores the
114 previous value on exit.
115 """
116 old = context.context().summary_recording
117 try:
118 context.context().summary_recording = condition
119 yield
120 finally:
121 context.context().summary_recording = old
122
123
124# TODO(apassos) consider how to handle local step here.

Callers 3

always_record_summariesFunction · 0.85
never_record_summariesFunction · 0.85

Calls 1

contextMethod · 0.45

Tested by

no test coverage detected