Python - tensorflow.concat() Last Updated : 26 Jun, 2020 Comments Improve Suggest changes Like Article Like Report TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning neural networks. concat() is used to concatenate tensors along one dimension. Syntax: tensorflow.concat( values, axis, name ) Parameter: values: It is a tensor or list of tensor.axis: It is 0-D tensor which represents dimension to concatenate.name(optional): It defines the name for the operation. Returns: It returns the concatenated Tensor. Example 1: Python3 # Importing the library import tensorflow as tf # Initializing the input tensor t1 = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] t2 = [[[7, 4], [8, 4]], [[2, 10], [15, 11]]] # Printing the input tensor print('t1: ', t1) print('t2: ', t2) # Calculating result res = tf.concat([t1, t2], 2) # Printing the result print('Result: ', res) Output: t1: [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] t2: [[[7, 4], [8, 4]], [[2, 10], [15, 11]]] Result: tf.Tensor( [[[ 1 2 7 4] [ 3 4 8 4]] [[ 5 6 2 10] [ 7 8 15 11]]], shape=(2, 2, 4), dtype=int32) Example 2: Python3 # Importing the library import tensorflow as tf # Initializing the input tensor t1 = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] t2 = [[[7, 4], [8, 4]], [[2, 10], [15, 11]]] # Printing the input tensor print('t1: ', t1) print('t2: ', t2) # Calculating result res = tf.concat([t1, t2], 1) # Printing the result print('Result: ', res) Output: t1: [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] t2: [[[7, 4], [8, 4]], [[2, 10], [15, 11]]] Result: tf.Tensor( [[[ 1 2] [ 3 4] [ 7 4] [ 8 4]] [[ 5 6] [ 7 8] [ 2 10] [15 11]]], shape=(2, 4, 2), dtype=int32) Comment More infoAdvertise with us Next Article Python - tensorflow.concat() aman neekhara Follow Improve Article Tags : Python Python-Tensorflow Practice Tags : python Similar Reads 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.gather() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. gather() is used to slice the input tensor based on the indices provided. Syntax: tensorflow.gather( params, indices, validate_indices, axis, batch_dims, name) Paramete 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.identity() 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 def 2 min read Python - tensorflow.gather_nd() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. gather_nd() is used to gather the slice from input tensor based on the indices provided. Syntax: tensorflow.gather_nd( params, indices, batch_dims, name) Parameters: pa 2 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.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.convert_to_tensor() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. convert_to_tensor() is used to convert the given value to a Tensor Syntax: tensorflow.convert_to_tensor( value, dtype, dtype_hint, name ) Parameters: value: It is the va 2 min read Python - tensorflow.constant_initializer() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. constant_initializer() is initializer that generate a Tensor with constant value. Syntax: tensorflow.constant_initializer( value ) Parameters: value: It is the value tha 1 min read Python - tensorflow.expand_dims() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. expand_dims() is used to insert an addition dimension in input Tensor. Syntax: tensorflow.expand_dims( input, axis, name) Parameters: input: It is the input Tensor.axis 2 min read Like