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

Method _snapshot_tensor

tensorflow/python/tpu/tensor_tracer.py:516–528  ·  view source on GitHub ↗

Creates a new tf.Variable and a new tf.Operation that assigns the value of the tensor to this variable. Args: tensor: tensor whose values will be stored in a new tf.Variable. Returns: An assignment operation.

(self, tensor)

Source from the content-addressed store, hash-verified

514 return state_ops.scatter_update(cache, indices, updates).op
515
516 def _snapshot_tensor(self, tensor):
517 """Creates a new tf.Variable and a new tf.Operation that assigns the value of the tensor to this variable.
518
519 Args:
520 tensor: tensor whose values will be stored in a new tf.Variable.
521 Returns:
522 An assignment operation.
523 """
524
525 snapshot_variable = self._create_or_get_tensor_values_cache(
526 tensor.name, tensor.op.graph,
527 tensor.shape.as_list(), tensor.dtype)
528 return state_ops.assign(snapshot_variable, tensor).op
529
530 def _preprocess_traced_tensor(self, tensor):
531 """Computes NAN/Norm/Max on TPUs before sending to CPU.

Callers 1

_trace_executionMethod · 0.95

Calls 3

as_listMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected