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

Function _Identity

tensorflow/python/ops/control_flow_ops.py:179–198  ·  view source on GitHub ↗

Return a tensor with the same shape and contents as the input tensor. Args: data: A Tensor. name: A name for this operation (optional). Returns: A Tensor with the same type and value as the input Tensor.

(data, name=None)

Source from the content-addressed store, hash-verified

177
178
179def _Identity(data, name=None):
180 """Return a tensor with the same shape and contents as the input tensor.
181
182 Args:
183 data: A Tensor.
184 name: A name for this operation (optional).
185
186 Returns:
187 A Tensor with the same type and value as the input Tensor.
188 """
189 data = ops.internal_convert_to_tensor_or_composite(data, as_ref=True)
190 if isinstance(data, ops.Tensor):
191 if data.dtype._is_ref_dtype: # pylint: disable=protected-access
192 return gen_array_ops.ref_identity(data, name=name)
193 else:
194 return array_ops.identity(data, name=name)
195 elif isinstance(data, composite_tensor.CompositeTensor):
196 return nest.map_structure(_Identity, data, expand_composites=True)
197 else:
198 raise TypeError("Type %s not supported" % type(data))
199
200
201def _NextIteration(data, name=None):

Callers 2

_BuildLoopMethod · 0.85
with_dependenciesFunction · 0.85

Calls 2

typeFunction · 0.85
identityMethod · 0.45

Tested by

no test coverage detected