IsInf#
Domain:
ai.onnxSince version: 20
Map infinity to true and other values to false.
Inputs
X (T1): input
Outputs
Y (T2): output
Attributes
detect_negative (int): (Optional) Whether map negative infinity to true. Default to 1 so that negative infinity induces true. Set this attribute to 0 if negative infinity should be mapped to false.
detect_positive (int): (Optional) Whether map positive infinity to true. Default to 1 so that positive infinity induces true. Set this attribute to 0 if positive infinity should be mapped to false.
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_isinf
Node:
IsInf(x) -> (y)
Inputs:
x: shape=(3,), dtype=float32
[ 1., inf, -inf]
Outputs:
y: shape=(3,), dtype=bool
[False, True, True]
test_isinf
Node:
IsInf(x) -> (y)
Inputs:
x: shape=(6,), dtype=float32
[-1.2, nan, inf, 2.8, -inf, inf]
Outputs:
y: shape=(6,), dtype=bool
[False, False, True, False, True, True]
test_isinf_float16
Node:
IsInf(x) -> (y)
Inputs:
x: shape=(6,), dtype=float16
[-inf, -1., 0., 1., inf, nan]
Outputs:
y: shape=(6,), dtype=bool
[ True, False, False, False, True, False]
test_isinf_negative
Node:
IsInf(x) -> (y)
Attributes:
detect_positive = 0
Inputs:
x: shape=(6,), dtype=float32
[-1.7, nan, inf, -3.6, -inf, inf]
Outputs:
y: shape=(6,), dtype=bool
[False, False, False, False, True, False]
test_isinf_positive
Node:
IsInf(x) -> (y)
Attributes:
detect_negative = 0
Inputs:
x: shape=(6,), dtype=float32
[-1.7, nan, inf, 3.6, -inf, inf]
Outputs:
y: shape=(6,), dtype=bool
[False, False, True, False, False, True]
Differences with previous version (10)#
SchemaDiff: IsInf (domain 'ai.onnx')
old version: 10
new version: 20
breaking: no
Type constraints:
changed ‘T1’: added types: [‘tensor(bfloat16)’, ‘tensor(float16)’, ‘tensor(float8e4m3fn)’, ‘tensor(float8e4m3fnuz)’, ‘tensor(float8e5m2)’, ‘tensor(float8e5m2fnuz)’]