.. _op_ai_onnx_IsNaN: IsNaN ===== - **Domain**: ``ai.onnx`` - **Since version**: 20 Returns which elements of the input are NaN. **Inputs** - **X** (*T1*): input **Outputs** - **Y** (*T2*): output **Type Constraints** - **T1**: Constrain input types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz). - **T2**: Constrain output types to boolean tensors. Allowed types: tensor(bool). Examples -------- **test_cc_isnan** .. code-block:: text Node: IsNaN(x) -> (y) .. code-block:: text Inputs: x: shape=(3,), dtype=float32 [ 1., nan, 2.] Outputs: y: shape=(3,), dtype=bool [False, True, False] **test_cc_isnan_bfloat16** .. code-block:: text Node: IsNaN(x) -> (y) .. code-block:: text Inputs: x: shape=(6,), dtype=bfloat16 [-1.20312, nan, inf, 2.79688, -inf, inf] Outputs: y: shape=(6,), dtype=bool [False, True, False, False, False, False] **test_cc_isnan_double** .. code-block:: text Node: IsNaN(x) -> (y) .. code-block:: text Inputs: x: shape=(6,), dtype=float64 [-1.2, nan, inf, 2.8, -inf, nan] Outputs: y: shape=(6,), dtype=bool [False, True, False, False, False, True] **test_isnan** .. code-block:: text Node: IsNaN(x) -> (y) .. code-block:: text Inputs: x: shape=(6,), dtype=float32 [-1.2, nan, inf, 2.8, -inf, inf] Outputs: y: shape=(6,), dtype=bool [False, True, False, False, False, False] **test_isnan_float16** .. code-block:: text Node: IsNaN(x) -> (y) .. code-block:: text Inputs: x: shape=(6,), dtype=float16 [-1.2, nan, inf, 2.8, -inf, inf] Outputs: y: shape=(6,), dtype=bool [False, True, False, False, False, False] Differences with previous version (13) -------------------------------------- **SchemaDiff**: ``IsNaN`` (domain ``'ai.onnx'``) * old version: 13 * new version: 20 * breaking: no **Type constraints:** * changed 'T1': added types: ['tensor(float8e4m3fn)', 'tensor(float8e4m3fnuz)', 'tensor(float8e5m2)', 'tensor(float8e5m2fnuz)'] Version History --------------- - :doc:`Version 13 ` - :doc:`Version 9 `