oneflow.eq¶
-
oneflow.
eq
(input, other) → Tensor¶ Computes element-wise equality. The second argument can be a number or a tensor whose shape is broadcastable with the first argument.
- Parameters
input (oneflow.Tensor) – the tensor to compare
other (oneflow.Tensor, float or int) – the target to compare
- Returns
A boolean tensor that is True where
input
is equal toother
and False elsewhere
For example:
>>> import oneflow as flow >>> import numpy as np >>> input = flow.tensor(np.array([2, 3, 4, 5]), dtype=flow.float32) >>> other = flow.tensor(np.array([2, 3, 4, 1]), dtype=flow.float32) >>> y = flow.eq(input, other) >>> y tensor([ True, True, True, False], dtype=oneflow.bool)