tf.identity
Stay organized with collections
Save and categorize content based on your preferences.
Return a tensor with the same shape and contents as input.
tf.identity(
input, name=None
)
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 .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.identity\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/identity) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/array_ops.py#L238-L271) |\n\nReturn a tensor with the same shape and contents as input.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.identity`](/api_docs/python/tf/identity)\n\n\u003cbr /\u003e\n\n tf.identity(\n input, name=None\n )\n\n#### For example:\n\n import tensorflow as tf\n val0 = tf.ones((1,), dtype=tf.float32)\n a = tf.atan2(val0, val0)\n a_identity = tf.identity(a)\n print(a.numpy()) #[0.7853982]\n print(a_identity.numpy()) #[0.7853982]\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------|--------------------------------------|\n| `input` | A `Tensor`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor`. Has the same type as `input`. ||\n\n\u003cbr /\u003e"]]