If - version 11#
This page documents version 11 of operator If. See If for the latest version (since version 13).
Domain:
ai.onnxSince version: 11
If conditional
Inputs
cond (B): Condition for the if. The tensor must contain a single element.
Outputs
outputs (V): Values that are live-out to the enclosing scope. The return values in the
then_branchandelse_branchmust be of the same data type. Thethen_branchandelse_branchmay produce tensors with the same element type and different shapes. If corresponding outputs from the then-branch and the else-branch have static shapes S1 and S2, then the shape of the corresponding output variable of the if-node (if present) must be compatible with both S1 and S2 as it represents the union of both possible shapes.For example, if in a model file, the first output ofthen_branchis typed float tensor with shape [2] and the first output ofelse_branchis another float tensor with shape [3], If’s first output should have (a) no shape set, or (b) a shape of rank 1 with neitherdim_valuenordim_paramset, or (c) a shape of rank 1 with a uniquedim_param. In contrast, the first output cannot have the shape [2] since [2] and [3] are not compatible.
Type Constraints
V: All Tensor types Allowed types: tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8).
B: Only bool Allowed types: tensor(bool).
Differences with previous version (1)#
SchemaDiff: If (domain 'ai.onnx')
old version: 1
new version: 11
breaking: no