MCPcopy
hub / github.com/hojonathanho/diffusion / scalar

Method scalar

diffusion_tf/tpu_utils/tpu_summaries.py:42–50  ·  view source on GitHub ↗

Add a summary for a scalar tensor.

(self, name, tensor, reduce_fn=tf.math.reduce_mean)

Source from the content-addressed store, hash-verified

40 TpuSummaryEntry(summary.image, name, tensor, reduce_fn))
41
42 def scalar(self, name, tensor, reduce_fn=tf.math.reduce_mean):
43 """Add a summary for a scalar tensor."""
44 if not self.record:
45 return
46 tensor = tf.convert_to_tensor(tensor)
47 if tensor.shape.ndims == 0:
48 tensor = tf.expand_dims(tensor, 0)
49 self._entries.append(
50 TpuSummaryEntry(summary.scalar, name, tensor, reduce_fn))
51
52 def get_host_call(self):
53 """Returns the tuple (host_call_fn, host_call_args) for TPUEstimatorSpec."""

Callers 2

model_fnFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected