Tensorflow.js tf.print() Function Last Updated : 10 May, 2021 Comments Improve Suggest changes 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. It helps developers to develop ML models in JavaScript, and use ML directly in the browser or in Node.js. The tf.print() function is used to print information about the tf.tensor along with its data. Syntax: tf.print (x, verbose) Parameter: x: The tensor which is to be printedverbose: It is an optional argument. These are the boolean parameter which decides whether to print the verbose information about the Tensor, including dtype and size. Return: It returns nothing i.e, void. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Setting the value of verbose const verbose = true; // Creating the tensor var val = tf.tensor2d([8, 2, 5, 6], [2, 2]); // Printing the tensor val.print(verbose) Output: Tensor dtype: float32 rank: 2 shape: [2,2] values: [[8, 2], [5, 6]] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Setting the value of verbose const verbose = false; // Creating the tensor var val = tf.tensor2d([8, 2, 5, 6], [2, 2]); // Printing the tensor val.print(verbose) Output: Tensor [[8, 2], [5, 6]] Reference: https://js.tensorflow.org/api/3.4.0/#print Comment More infoAdvertise with us Next Article Tensorflow.js tf.print() Function C CoderSaty Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.sin() 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 .sin() function is used to find the sin of the stated tensor input, and it is done element wise. Syntax : Â t 2 min read Tensorflow.js tf.sinh() function Tensorflow.js is an open-source library which is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .sinh() function is used to find the hyperbolic sin of the stated tensor input and is done elements wise. Sy 2 min read Tensorflow.js tf.profile() 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. It also helps the developers to develop ML models in JavaScript language and can use ML directly in the browser or in Node.js. The tf. 1 min read Tensorflow.js tf.pad() 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. It also helps the developers to develop ML models in JavaScript language and can use ML directly in the browser or in Node.js. The tf. 2 min read Tensorflow.js tf.tan() 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 .tan() function is used to find the tangent of the stated tensor input and is done element wise. Syntax: tf.t 2 min read Like