Tensorflow.js tf.broadcastTo() Function
Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment.
The .broadcastTo() function is used to circulate an array to a consistent model of NumPy-style.
- Here, the shape of the tensor is equated to the shape of the broadcast from last to the start. Where, 1’s are prefixed to the shape of the tensor as long as it has the equivalent length like the shape of the broadcast.
- In case, input.shape[i]==shape[i], then the (i+1)-th axis is formerly consistent to the broadcast and in case, input.shape[i]==1 plus shape[i]==N, then the stated input tensor is covered N times by that axis.
- x: It is the stated tensor input and it can be of type tf.Tensor, TypedArray, or Array.
- shape: It is the stated shape where the input is to be broadcasted to.
Return Value: It returns the tf.Tensor object.
Tensor [[1, 2, 3, 4],]
Tensor [[3.5999999, 5.8000002, 3.7, 1.4, 9.3000002, 10.5],]