megengine.functional.not_equal¶
- not_equal(x, y)[source]¶
Element-wise inequality comparison.
Computes the truth value of
for each element of the input tensor with the respective element of the input tensor .- Parameters
x – first input tensor. May have any data type.
y – second input tensor. Must be compatible with
(see Broadcasting mechanism and rules ). May have any data type.
- Returns
a tensor containing the result of the element-wise results. The returned tensor must have a data type of
bool
.
See also
Examples
Element-wise inequality comparison:
>>> x = Tensor([1, 2, 3]) >>> y = Tensor([1, 2, 4]) >>> F.not_equal(x, y) Tensor([False False True], dtype=bool, device=xpux:0)
The
!=
operator can be used as a shorthand forF.not_equal
on boolean tensors.>>> x != y Tensor([False False True], dtype=bool, device=xpux:0)