Tensorflow.js tf.Tensor class .print() Method Last Updated : 22 Apr, 2022 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. The tf.print() function is used to Prints information about the tf.Tensor including its data. Syntax: tf.print(value, verbose) Parameters: value: The value of the tensor which can be a simple or nested Array or TypedArray of numbers. If the array elements are Strings then they will encode as UTF-8 and kept as Uint8Array[].verbose: It is a boolean value to tell whether to print verbose information about the Tensor, including dtype and size and the default value of verbose is False. The below examples demonstrate the tf.print() function: Example 1: In this example, we use the ts.tensor2d to create a tensor, and we are printing using tf.print function using the verbose value as true. JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Creating the tensor const verbose = true; var val = tf.tensor2d(["geeks","for","geeks","website"], [2, 2]); // Printing the tensor val.print(verbose); Output: Tensor dtype: string rank: 2 shape: [2,2] values: [['geeks', 'for' ], ['geeks', 'website']] Example 2: In this example, we use the ts.tensor2d to create a tensor, and we are printing using tf.print function using the verbose value as false. JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Creating the tensor const verbose = false; var val = tf.tensor(["geeks","for","geeks"]); // Printing the tensor val.print(verbose); Output: Tensor ['geeks', 'for', 'geeks'] Reference:https://js.tensorflow.org/api/latest/#tf.Tensor.print Comment More infoAdvertise with us Next Article Tensorflow.js tf.Tensor class .print() Method M magichat Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js TensorFlow.js-Classes TensorFlow.js-Tensor +1 More Similar Reads Tensorflow.js tf.Tensor class .data() Method 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.Tensor class .clone() Method Tensorflow.js is an open-source library for creating machine learning models in Javascript that allows users to run the models directly in the browser. The tf.clone() is a function defined in the class tf.Tensor. It's used to create a replica of a tensor. Syntax : tf.clone( values ) Parameters: valu 1 min read Tensorflow.js tf.Tensor class .array() Method 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 .ar 1 min read Tensorflow.js tf.TensorBuffer Class .set() Method 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.TensorBuffer class .set() function is used to set a given value in the buffer at a specified location. Syntax: set (value, ...l 2 min read Tensorflow.js tf.Tensor class .buffer() Method 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 Like