Tensorflow.js tf.onesLike() 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.
The tf.onesLike() function is used to create a tf.Tensor with all elements set to 1 with the same shape as the given tensor.
- x: a tf.Tensor whose all elements will be set as 1.
Return Value: It returns a tf.Tensor.
Tensor [1, 1]
Tensor [[1, 1], [1, 1]]