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
Returns

  • A boolean tensor that is True where input is equal to other 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)