tensor.where
#tensor.where
Computes a new tensor by selecting values from tensor x (resp. y) at indices where the condition is 1 (resp. 0).
Args
self
(@Tensor<T>
) - The condition tensorx
(@Tensor<T>
) - The first input tensory
(@Tensor<T>
) - The second input tensor
Panics
Panics if the shapes are not equal or broadcastable
Returns
Return a new Tensor<T>
of the same shape as the input with elements chosen from x or y depending on the condition.
Example
Last updated