Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Tensorflow.js tf.Tensor class .arraySync() Method

  • Last Updated : 24 May, 2021

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.Tensor class .arraySync() method is used to return the tensor data as a nested array.

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!



Parameters: It does not accept any parameters.

Return Value: It returns number[].

Example 1: Creating a 2d tensor.


const a = tf.tensor2d([[0, 1], [2, 3]])


[[0, 1], [2, 3]]

Example 2:


console.log(tf.tensor([1, 3, 5, 4, 2]).arraySync())


[1, 3, 5, 4, 2]


My Personal Notes arrow_drop_up
Recommended Articles
Page :