Python - tensorflow.identity() Last Updated : 20 Jul, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning neural networks. identity() returns a Tensor with the same shape and contents as input. Syntax: tensorflow.identity(input, name) Parameters: input: It is a Tensor.name(optional): It defines the name for the operation. Returns: It returns a Tensor with the same shape and contents as input. Example 1: Python3 # Importing the library import tensorflow as tf # Initializing the input data = tf.Variable([[1, 2, 3], [3, 4, 5], [5, 6, 7]]) # Printing the input print('data: ', data) # Calculating result res = tf.identity(data) # Printing the result print('res: ', res) Output: data: <tf.Variable 'Variable:0' shape=(3, 3) dtype=int32, numpy= array([[1, 2, 3], [3, 4, 5], [5, 6, 7]], dtype=int32)> res: tf.Tensor( [[1 2 3] [3 4 5] [5 6 7]], shape=(3, 3), dtype=int32) Example 2: Python3 # Importing the library import tensorflow as tf # Initializing the input data = tf.constant([[1, 2, 3], [3, 4, 5], [5, 6, 7]]) # Printing the input print('data: ', data) # Calculating result res = tf.identity(data) # Printing the result print('res: ', res) Output: data: tf.Tensor( [[1 2 3] [3 4 5] [5 6 7]], shape=(3, 3), dtype=int32) res: tf.Tensor( [[1 2 3] [3 4 5] [5 6 7]], shape=(3, 3), dtype=int32) Comment More infoAdvertise with us Next Article Python - tensorflow.fill() A aman neekhara Follow Improve Article Tags : Python Tensorflow Python-Tensorflow Practice Tags : python Similar Reads Python - tensorflow.identity_n() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. identity_n() is used get a list of Tensor with same shape and content as input Tensor. Syntax: tensorflow.identity_n( input, name) Parameters: input:  It is a Tensor.na 2 min read Python - tensorflow.eye() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. tensorflow.eye() is used to generate identity matrix. Syntax: tensorflow.eye( num_rows, num_columns, batch_shape, dtype, name) Parameters: num_rows: It is int32 scalar 2 min read Python - tensorflow.fingerprint() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. fingerprint() is used to generate fingerprint value. Syntax: tensorflow.fingerprint( data, method, name) Parameters: data: It is a Tensor having rank 1 or higher.method 2 min read Python - tensorflow.cond() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. cond() return true_fn() if the predicate pred is true otherwise it returns false_fn(). Syntax: tensorflow.cond( pred, true_fn, false_fn, name ) Parameters: pred: It is a 1 min read Python - tensorflow.fill() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. fill() is used to generate a tensor having scalar value. Syntax: tensorflow.fill( dims, value, name) Parameters: dims: It is 1-D sequence of dtype int32 or int64 with n 2 min read Python - tensorflow.IndexedSlices() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. IndexedSlices() is used to find the sparse representation of a set of tensor slices at given indices. Syntax: tensorflow.IndexedSlices(values, indices, dense_shape = No 1 min read Like