Add a summary for a scalar tensor.
(self, name, tensor, reduce_fn=tf.math.reduce_mean)
| 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.""" |
no outgoing calls
no test coverage detected