Tensorflow.js tf.transpose() Function Last Updated : 12 May, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.transpose() function is used to perform a regular matrix transpose operation on the specified 2-D input tensor. Syntax: tf.transpose (x)Parameters: This function accepts a parameter which is illustrated below: x: The specified input tensor to transpose.Return Value: It returns a tensor as the output for the transpose operation. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Initializing a tensor of matrix along with // its dimension const a = tf.tensor2d([2, 4, 6, 8], [2, 2]); // Calling the .transpose() function over the // above tensor as its parameter a.transpose().print(); Output: Tensor [[2, 6], [4, 8]]Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Using some tensor of matrix along with its dimensions // as the parameter for .transpose() functions tf.tensor2d([1, 3, 5, 7, 9, 11], [2, 3]).transpose().print(); tf.tensor2d([1, 3, 5, 7, 9, 11], [3, 2]).transpose().print(); Output: Tensor [[1, 7 ], [3, 9 ], [5, 11]] Tensor [[1, 5, 9 ], [3, 7, 11]] Reference: https://js.tensorflow.org/api/latest/#transpose Comment More infoAdvertise with us Next Article Tensorflow.js tf.transpose() Function K Kanchan_Ray Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.zeros() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.zeros() function is used to create a new tensor with all elements set to zero. Syntax: tf.zeros(shape, dataType) Parameters: sh 2 min read Tensorflow.js tf.zerosLike() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.zeroslIke() is used to create a tf.tensor with all elements set to '0' with the same shape as the given tensor by passing the p 3 min read Tensorflow.js tf.tile() Function TensorFlow.js is a library for machine learning in JavaScript. It helps developers to develop ML models in JavaScript, and use ML directly in the browser or in Node.js. The tf.tile() function is used to create a Tensor by repeating the number of times given by reps. Syntax: tf.tile(x, reps)Note: Thi 2 min read Tensorflow.js tf.image.transform() Function Tensorflow.js is an open-source library developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .image.transform() function is used to apply the specified transform(s) to the image(s). Syntax: tf.image.transform(image, 3 min read Tensorflow.js tf.unique() Function Tensorflow.js is an open-source library that is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .unique() function is used to find unique elements along an axis of a tensor. Â Syntax: tf.unique (x, axis?) 2 min read Like