W3cubDocs

/TensorFlow 1.15

tf.identity

View source on GitHub

Return a tensor with the same shape and contents as input.

For example:

import tensorflow as tf
val0 = tf.ones((1,), dtype=tf.float32)
a = tf.atan2(val0, val0)
a_identity = tf.identity(a)
print(a.numpy())          #[0.7853982]
print(a_identity.numpy()) #[0.7853982]
Args
input A Tensor.
name A name for the operation (optional).
Returns
A Tensor. Has the same type as input.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/identity