Return a tensor with the same shape and contents as the input tensor or value.
Args:
input: A Tensor.
name: A name for the operation (optional).
Returns:
输出:
输出:
Args:
input: A Tensor.
name: A name for the operation (optional).
Returns:
A Tensor. Has the same type as input.
举例:
a = tf.random_uniform([2,3], minval = 10, maxval = 11)
sess.run(a)
输出:
array([[ 10.32342529, 10.05036354, 10.71219158],
[ 10.92466164, 10.04347134, 10.30799294]], dtype=float32)
b = tf.identity(a)
sess.run(b)
输出:
array([[ 10.19113731, 10.08955765, 10.86665058],
[ 10.10772514, 10.18272018, 10.47456551]], dtype=float32)
总结:两个输出是一样的,所以identity可以理解完成了tensor的复制,产生了一个同样形状和内容的tensor