Tensorflow.js tf.booleanMaskAsync() 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 .booleanMaskAsync() function is used to implement boolean mask to the stated input tensor.
tf.booleanMaskAsync(tensor, mask, axis?)
- tensor: It is the stated N-D tensor and it can be of type tf.Tensor, TypedArray, or Array.
- mask: It is the stated K-D boolean tensor. Where, K <= N plus K should be inactively recognized. It can be of type tf.Tensor, TypedArray, or Array.
- axis: It is an optional parameter of type number. It is a 0-D integer type tensor that represents the axis in the stated tensor that is to be masked from. Here, the by default value is zero that masks from the first size, else (K + axis <= N).
Return Value: It returns Promise(tf.Tensor).
Tensor [[7 , 8 ], [9 , 10], [11, 12], [5 , 62]]
Tensor [[34, 17], [7 , 8 ]]