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

Method unsafe_scalar_trace

tensorflow/python/tpu/tensor_tracer.py:295–311  ·  view source on GitHub ↗

Return true if scalar output tensor from Op is not safe to be traced.

(op)

Source from the content-addressed store, hash-verified

293
294 @staticmethod
295 def unsafe_scalar_trace(op):
296 """Return true if scalar output tensor from Op is not safe to be traced."""
297
298 # Tracing the following causes cycle in the graph on TPU.
299 if op.type in ('LoopCond', 'Enter', 'Merge', 'Const',
300 'Switch', 'Less', 'ReadVariableOp'):
301 return True
302 # Tracing the following will cause casting-issue
303 # with the norm tracing mode or other compilation issues on CPU.
304 if op.type in ('VarHandleOp', 'IteratorToStringHandle',
305 'IteratorGetNext', 'OneShotIterator',
306 'IteratorV2', 'MakeIterator',
307 'BatchDatasetV2', 'MapDataset',
308 'FixedLengthRecordDataset', 'TakeDataset', 'ZipDataset',
309 'Placeholder', 'PlaceholderWithDefault', 'StridedSlice'):
310 return True
311 return False
312
313 def _less_interesting_op(self, op):
314 """Returns True if the given op is not an interesting one to be traced."""

Callers 1

_skip_tensorMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected