Tensorflow.js tf.squeeze() 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 .squeeze() function is used to discard the dimensions of length one out of the shape of a stated tf.Tensor.
- x: It is the stated tensor input which is to be squeezed, and it can be of type tf.Tensor, TypedArray, or Array.
- axis: It is an elective parameter that holds a list of numbers. It squeezes only the stated dimensions in case its specified. Moreover, the dimension index here begins with zero, and it’s a flaw to compress a dimension whose length is not one.
Return Value: It returns the tf.Tensor object.
Tensor [[11, 76], [-4, 6 ]]
Tensor [2.0999999, 5.5999999, 8.6000004, 7.5999999]