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)
| 177 | |
| 178 | |
| 179 | def _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 | |
| 201 | def _NextIteration(data, name=None): |
no test coverage detected