Tensorflow.js tf.Tensor class .print() 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.print() function is used to Prints information about the tf.Tensor including its data.
- 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.
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.
Tensor ['geeks', 'for', 'geeks']
My Personal Notes arrow_drop_up
Please Login to comment...