(l-onnx-doc-IsNaN)= # IsNaN (l-onnx-op-isnan-20)= ## IsNaN - 20 ### Version - **name**: [IsNaN (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#IsNaN) - **domain**: `main` - **since_version**: `20` - **function**: `False` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 20**. ### Summary Returns which elements of the input are NaN. ### Inputs - **X** (heterogeneous) - **T1**: input ### Outputs - **Y** (heterogeneous) - **T2**: output ### Type Constraints * **T1** in ( `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)` ): Constrain input types to float tensors. * **T2** in ( `tensor(bool)` ): Constrain output types to boolean tensors. ### Examples #### default ```python import numpy as np import onnx node = onnx.helper.make_node( "IsNaN", inputs=["x"], outputs=["y"], ) x = np.array([-1.2, np.nan, np.inf, 2.8, -np.inf, np.inf], dtype=np.float32) y = np.isnan(x) expect(node, inputs=[x], outputs=[y], name="test_isnan") ``` #### _float16 ```python import numpy as np import onnx node = onnx.helper.make_node( "IsNaN", inputs=["x"], outputs=["y"], ) x = np.array([-1.2, np.nan, np.inf, 2.8, -np.inf, np.inf], dtype=np.float16) y = np.isnan(x) expect(node, inputs=[x], outputs=[y], name="test_isnan_float16") ``` ```{toctree} text_diff_IsNaN_13_20 ``` (l-onnx-op-isnan-13)= ## IsNaN - 13 ### Version - **name**: [IsNaN (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#IsNaN) - **domain**: `main` - **since_version**: `13` - **function**: `False` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 13**. ### Summary Returns which elements of the input are NaN. ### Inputs - **X** (heterogeneous) - **T1**: input ### Outputs - **Y** (heterogeneous) - **T2**: output ### Type Constraints * **T1** in ( `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` ): Constrain input types to float tensors. * **T2** in ( `tensor(bool)` ): Constrain output types to boolean tensors. ```{toctree} text_diff_IsNaN_9_20 text_diff_IsNaN_9_13 ``` (l-onnx-op-isnan-9)= ## IsNaN - 9 ### Version - **name**: [IsNaN (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#IsNaN) - **domain**: `main` - **since_version**: `9` - **function**: `False` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 9**. ### Summary Returns which elements of the input are NaN. ### Inputs - **X** (heterogeneous) - **T1**: input ### Outputs - **Y** (heterogeneous) - **T2**: output ### Type Constraints * **T1** in ( `tensor(double)`, `tensor(float)`, `tensor(float16)` ): Constrain input types to float tensors. * **T2** in ( `tensor(bool)` ): Constrain output types to boolean tensors.