(l-onnx-doc-LessOrEqual)= # LessOrEqual (l-onnx-op-lessorequal-16)= ## LessOrEqual - 16 ### Version - **name**: [LessOrEqual (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#LessOrEqual) - **domain**: `main` - **since_version**: `16` - **function**: `True` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 16**. ### Summary Returns the tensor resulted from performing the `less_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](https://github.com/onnx/onnx/blob/main/docs/Broadcasting.md). #### Function Body The function definition for this operator. ``` < domain: "", opset_import: ["" : 16] > LessOrEqual (A, B) => (C) { O1 = Less (A, B) O2 = Equal (A, B) C = Or (O1, O2) } ``` ### 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(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. ### Examples #### default ```python import numpy as np import onnx node = onnx.helper.make_node( "LessOrEqual", inputs=["x", "y"], outputs=["less_equal"], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(3, 4, 5).astype(np.float32) z = np.less_equal(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_less_equal") x = np.random.randn(3, 4, 5).astype(np.int8) y = np.random.randn(3, 4, 5).astype(np.int8) z = np.less_equal(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_less_equal_int8") x = np.random.randn(3, 4, 5).astype(np.int16) y = np.random.randn(3, 4, 5).astype(np.int16) z = np.less_equal(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_less_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.less_equal(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_less_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.less_equal(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_less_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.less_equal(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_less_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.less_equal(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_less_equal_uint64") ``` #### _less_broadcast ```python import numpy as np import onnx node = onnx.helper.make_node( "LessOrEqual", inputs=["x", "y"], outputs=["less_equal"], ) x = np.random.randn(3, 4, 5).astype(np.float32) y = np.random.randn(5).astype(np.float32) z = np.less_equal(x, y) expect(node, inputs=[x, y], outputs=[z], name="test_less_equal_bcast") ``` ```{toctree} text_diff_LessOrEqual_12_16 ``` (l-onnx-op-lessorequal-12)= ## LessOrEqual - 12 ### Version - **name**: [LessOrEqual (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#LessOrEqual) - **domain**: `main` - **since_version**: `12` - **function**: `True` - **support_level**: `SupportType.COMMON` - **shape inference**: `False` This version of the operator has been available **since version 12**. ### Summary Returns the tensor resulted from performing the `less_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](https://github.com/onnx/onnx/blob/main/docs/Broadcasting.md). #### Function Body The function definition for this operator. ``` < domain: "", opset_import: ["" : 12] > LessOrEqual (A, B) => (C) { O1 = Less (A, B) O2 = Equal (A, B) C = Or (O1, O2) } ``` ### 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(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.