Equal¶
Equal - 19¶
Version¶
name: Equal (GitHub)
domain:
mainsince_version:
19function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 19.
Summary¶
Returns the tensor resulted from performing the equal logical operation
elementwise on the input tensors A and B (with Numpy-style broadcasting support).
This operator supports multidirectional (i.e., Numpy-style) broadcasting; for more details please check Broadcasting in ONNX.
Inputs¶
A (heterogeneous) - T:
First input operand for the logical operator.
B (heterogeneous) - T:
Second input operand for the logical operator.
Outputs¶
C (heterogeneous) - T1:
Result tensor.
Type Constraints¶
T in (
tensor(bfloat16),tensor(bool),tensor(double),tensor(float),tensor(float16),tensor(int16),tensor(int32),tensor(int64),tensor(int8),tensor(string),tensor(uint16),tensor(uint32),tensor(uint64),tensor(uint8)):Constrain input types to all (non-complex) tensors.
T1 in (
tensor(bool)):Constrain output to boolean tensor.
Examples¶
default¶
import numpy as np
import onnx
node = onnx.helper.make_node(
"Equal",
inputs=["x", "y"],
outputs=["z"],
)
x = (np.random.randn(3, 4, 5) * 10).astype(np.int32)
y = (np.random.randn(3, 4, 5) * 10).astype(np.int32)
z = np.equal(x, y)
expect(node, inputs=[x, y], outputs=[z], name="test_equal")
x = (np.random.randn(3, 4, 5) * 10).astype(np.int8)
y = (np.random.randn(3, 4, 5) * 10).astype(np.int8)
z = np.equal(x, y)
expect(node, inputs=[x, y], outputs=[z], name="test_equal_int8")
x = (np.random.randn(3, 4, 5) * 10).astype(np.int16)
y = (np.random.randn(3, 4, 5) * 10).astype(np.int16)
z = np.equal(x, y)
expect(node, inputs=[x, y], outputs=[z], name="test_equal_int16")
x = np.random.randint(24, size=(3, 4, 5), dtype=np.uint8)
y = np.random.randint(24, size=(3, 4, 5), dtype=np.uint8)
z = np.equal(x, y)
expect(node, inputs=[x, y], outputs=[z], name="test_equal_uint8")
x = np.random.randint(24, size=(3, 4, 5), dtype=np.uint16)
y = np.random.randint(24, size=(3, 4, 5), dtype=np.uint16)
z = np.equal(x, y)
expect(node, inputs=[x, y], outputs=[z], name="test_equal_uint16")
x = np.random.randint(24, size=(3, 4, 5), dtype=np.uint32)
y = np.random.randint(24, size=(3, 4, 5), dtype=np.uint32)
z = np.equal(x, y)
expect(node, inputs=[x, y], outputs=[z], name="test_equal_uint32")
x = np.random.randint(24, size=(3, 4, 5), dtype=np.uint64)
y = np.random.randint(24, size=(3, 4, 5), dtype=np.uint64)
z = np.equal(x, y)
expect(node, inputs=[x, y], outputs=[z], name="test_equal_uint64")
_equal_broadcast¶
import numpy as np
import onnx
node = onnx.helper.make_node(
"Equal",
inputs=["x", "y"],
outputs=["z"],
)
x = (np.random.randn(3, 4, 5) * 10).astype(np.int32)
y = (np.random.randn(5) * 10).astype(np.int32)
z = np.equal(x, y)
expect(node, inputs=[x, y], outputs=[z], name="test_equal_bcast")
_equal_string¶
import numpy as np
import onnx
node = onnx.helper.make_node(
"Equal",
inputs=["x", "y"],
outputs=["z"],
)
x = np.array(["string1", "string2"], dtype=np.dtype(object))
y = np.array(["string1", "string3"], dtype=np.dtype(object))
z = np.equal(x, y)
expect(node, inputs=[x, y], outputs=[z], name="test_equal_string")
_equal_string_broadcast¶
import numpy as np
import onnx
node = onnx.helper.make_node(
"Equal",
inputs=["x", "y"],
outputs=["z"],
)
x = np.array(["string1", "string2"], dtype=np.dtype(object))
y = np.array(["string1"], dtype=np.dtype(object))
z = np.equal(x, y)
expect(node, inputs=[x, y], outputs=[z], name="test_equal_string_broadcast")
Equal - 13¶
Version¶
name: Equal (GitHub)
domain:
mainsince_version:
13function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 13.
Summary¶
Returns the tensor resulted from performing the equal logical operation
elementwise on the input tensors A and B (with Numpy-style broadcasting support).
This operator supports multidirectional (i.e., Numpy-style) broadcasting; for more details please check Broadcasting in ONNX.
Inputs¶
A (heterogeneous) - T:
First input operand for the logical operator.
B (heterogeneous) - T:
Second input operand for the logical operator.
Outputs¶
C (heterogeneous) - T1:
Result tensor.
Type Constraints¶
T in (
tensor(bfloat16),tensor(bool),tensor(double),tensor(float),tensor(float16),tensor(int16),tensor(int32),tensor(int64),tensor(int8),tensor(uint16),tensor(uint32),tensor(uint64),tensor(uint8)):Constrain input types to all numeric tensors.
T1 in (
tensor(bool)):Constrain output to boolean tensor.
Equal - 11¶
Version¶
name: Equal (GitHub)
domain:
mainsince_version:
11function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 11.
Summary¶
Returns the tensor resulted from performing the equal logical operation
elementwise on the input tensors A and B (with Numpy-style broadcasting support).
This operator supports multidirectional (i.e., Numpy-style) broadcasting; for more details please check Broadcasting in ONNX.
Inputs¶
A (heterogeneous) - T:
First input operand for the logical operator.
B (heterogeneous) - T:
Second input operand for the logical operator.
Outputs¶
C (heterogeneous) - T1:
Result tensor.
Type Constraints¶
T in (
tensor(bool),tensor(double),tensor(float),tensor(float16),tensor(int16),tensor(int32),tensor(int64),tensor(int8),tensor(uint16),tensor(uint32),tensor(uint64),tensor(uint8)):Constrain input types to all numeric tensors.
T1 in (
tensor(bool)):Constrain output to boolean tensor.
Equal - 7¶
Version¶
name: Equal (GitHub)
domain:
mainsince_version:
7function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 7.
Summary¶
Returns the tensor resulted from performing the equal logical operation
elementwise on the input tensors A and B (with Numpy-style broadcasting support).
This operator supports multidirectional (i.e., Numpy-style) broadcasting; for more details please check Broadcasting in ONNX.
Inputs¶
A (heterogeneous) - T:
First input operand for the logical operator.
B (heterogeneous) - T:
Second input operand for the logical operator.
Outputs¶
C (heterogeneous) - T1:
Result tensor.
Type Constraints¶
T in (
tensor(bool),tensor(int32),tensor(int64)):Constrain input to integral tensors.
T1 in (
tensor(bool)):Constrain output to boolean tensor.
Equal - 1¶
Version¶
name: Equal (GitHub)
domain:
mainsince_version:
1function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 1.
Summary¶
Returns the tensor resulted from performing the equal logical operation
elementwise on the input tensors A and B.
If broadcasting is enabled, the right-hand-side argument will be broadcasted
to match the shape of left-hand-side argument. See the doc of Add for a
detailed description of the broadcasting rules.
Attributes¶
axis - INT :
If set, defines the broadcast dimensions.
broadcast - INT (default is
0):Enable broadcasting
Inputs¶
A (heterogeneous) - T:
Left input tensor for the logical operator.
B (heterogeneous) - T:
Right input tensor for the logical operator.
Outputs¶
C (heterogeneous) - T1:
Result tensor.
Type Constraints¶
T in (
tensor(bool),tensor(int32),tensor(int64)):Constrain input to integral tensors.
T1 in (
tensor(bool)):Constrain output to boolean tensor.