Tensorflow.js tf.Tensor class .array() 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. 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 .array() method is used to return the tensor input like a nested array. Moreover, the relocation of data is made asynchronously. Syntax: array()Parameters: This method does not hold any parameters. Return Value: It returns the promise of number[]. Example 1: JavaScript // Importing tensorflow library import * as tf from "@tensorflow/tfjs" // Creating a tensor const tn = tf.tensor([5, 6, 3, 4]); // Calling array() method const res = await tn.array(); // Printing output console.log(res) Output: 5,6,3,4 Example 2: JavaScript // Importing tensorflow library import * as tf from "@tensorflow/tfjs" // Calling array() method and // Printing output console.log(await tf.tensor2d([1.7, 3.7, 9.7, null], [4, 1]).array()); Output: 1.7000000476837158,3.700000047683716,9.699999809265137,0 Reference: https://js.tensorflow.org/api/latest/#tf.Tensor.array Comment More infoAdvertise with us Next Article Tensorflow.js tf.Tensor class .array() Method N nidhi1352singh Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js TensorFlow.js-Classes TensorFlow.js-Tensor +1 More Similar Reads Tensorflow.js tf.Tensor class .arraySync() 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.T 1 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 Tensorflow.js tf.Tensor class .bufferSync() 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 .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 .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. Syntax: tf.print(value, verbose) Paramet 2 min read Like