Tensorflow.js tf.where() 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.where() function is used to returns the elements, either of first tensor or second tensor depending on the specified condition. If the given condition is true, it select from the first tensor else select form the second tensor.
tf.where (condition, a, b)
Parameters: This function accepts three parameters which are illustrated below:
- condition: The input condition which should must have Boolean datatype.
- a: The first input tensor with dimension same as the size of condition.
- b: The second input tensor with shape that is compatible with “a”. It should must have same data type as “a”.
Return Value: It returns the tensor of elements, either of first tensor or second tensor depending on the specified condition.
Tensor [-2, -4, -6, -8]
Tensor [10, 200, 30, 400]
My Personal Notes arrow_drop_up
Please Login to comment...