{ "op": "ai.onnx.If", "cases": [ { "name": "lowered_dispatch_cliff_select_then", "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } }, "then_value": { "dtype": "float32", "shape": [16777216], "data": { "kind": "constant", "value": 1.5 } }, "else_value": { "dtype": "float32", "shape": [16777216], "data": { "kind": "constant", "value": -2.5 } } }, "outputs": { "y": { "dtype": "float32", "shape": [16777216], "tolerance": 0 } } }, { "name": "lowered_select_then", "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } }, "then_value": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } }, "else_value": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [-1.0, -2.0, -3.0, -4.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 2] } } }, { "name": "lowered_select_else", "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [0] } }, "then_value": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [10.0, 20.0, 30.0] } }, "else_value": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [4.0, 5.0, 6.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [3] } } }, { "name": "lowered_ort_projection_outer_scope_add_then", "provenance": { "source": "onnxruntime/test/providers/cpu/controlflow/if_test.cc", "test": "If.ShapeInMainGraph_NoShapeInSubgraph_True", "notes": "Projection onto the framework's lowered select variant: ORT's then branch computes split_out_0 + if_graph_input_0 = 2." }, "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } }, "then_value": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [2.0] } }, "else_value": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [11.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [1], "tolerance": 0 } } }, { "name": "lowered_ort_projection_outer_scope_add_else", "provenance": { "source": "onnxruntime/test/providers/cpu/controlflow/if_test.cc", "test": "If.ShapeInMainGraph_NoShapeInSubgraph_False", "notes": "Projection onto the framework's lowered select variant: ORT's else branch computes split_out_1 + if_graph_input_0 = 11." }, "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [0] } }, "then_value": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [2.0] } }, "else_value": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [11.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [1], "tolerance": 0 } } }, { "name": "lowered_ort_projection_constant_then_branch", "provenance": { "source": "onnxruntime/test/providers/cpu/controlflow/if_test.cc", "test": "If.ConditionalBranchesOnlyContainConstantNodes_ThenBranchExecution", "notes": "Projection onto the framework's lowered select variant: branch subgraphs are represented by precomputed branch tensors." }, "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } }, "then_value": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [10.0] } }, "else_value": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [1000.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [1] } } }, { "name": "lowered_ort_projection_constant_else_branch", "provenance": { "source": "onnxruntime/test/providers/cpu/controlflow/if_test.cc", "test": "If.ConditionalBranchesOnlyContainConstantNodes_ElseBranchExecution", "notes": "Projection onto the framework's lowered select variant: branch subgraphs are represented by precomputed branch tensors." }, "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [0] } }, "then_value": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [10.0] } }, "else_value": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [1000.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [1] } } }, { "name": "lowered_ort_projection_different_branch_shapes_then", "provenance": { "source": "onnxruntime/test/providers/cpu/controlflow/if_test.cc", "test": "If.Opset11ThenAndElseBranchesProduceDifferentOutputShapes", "notes": "Projection onto the framework's lowered select variant: branch tensors use different ranks with equal storage size, and the selected then branch fixes the output shape." }, "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } }, "then_value": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } }, "else_value": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [-1.0, -2.0, -3.0, -4.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 2] } } }, { "name": "lowered_ort_projection_different_branch_shapes_else", "provenance": { "source": "onnxruntime/test/providers/cpu/controlflow/if_test.cc", "test": "If.Opset11ThenAndElseBranchesProduceDifferentOutputShapes", "notes": "Projection onto the framework's lowered select variant: branch tensors use different ranks with equal storage size, and the selected else branch fixes the output shape." }, "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [0] } }, "then_value": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } }, "else_value": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [-1.0, -2.0, -3.0, -4.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [4] } } }, { "name": "lowered_select_then_scalar", "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } }, "then_value": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [42.0] } }, "else_value": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [-42.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [] } } }, { "name": "lowered_scalar_cond_then", "provenance": { "source": "onnxruntime/test/providers/cpu/controlflow/if_test.cc", "test": "If.ConditionalBranchesOnlyContainConstantNodes_ThenBranchExecution", "notes": "ONNX If condition is a scalar bool. The project-lowered select form should accept scalar logical uint32 conditions as well as [1] conditions." }, "inputs": { "cond": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [1] } }, "then_value": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [9.0, -3.0] } }, "else_value": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [4.0, 5.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [2], "tolerance": 0 } } }, { "name": "lowered_scalar_cond_else", "provenance": { "source": "onnxruntime/test/providers/cpu/controlflow/if_test.cc", "test": "If.ConditionalBranchesOnlyContainConstantNodes_ElseBranchExecution", "notes": "ONNX If condition is a scalar bool. This exercises the false branch with scalar logical uint32 condition storage." }, "inputs": { "cond": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [0] } }, "then_value": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [9.0, -3.0] } }, "else_value": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [4.0, 5.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [2], "tolerance": 0 } } }, { "name": "lowered_bool_scalar_cond_then", "provenance": { "source": "onnxruntime/test/providers/cpu/controlflow/if_test.cc", "test": "If.ConditionalBranchesOnlyContainConstantNodes_ThenBranchExecution", "notes": "ONNX If conditions are bool tensors. This lowered projection verifies scalar logical bool storage selects the then branch." }, "inputs": { "cond": { "dtype": "bool", "shape": [], "data": { "kind": "values", "values": [1] } }, "then_value": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1.25, -2.5, 3.75] } }, "else_value": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [-10.0, -20.0, -30.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [3], "tolerance": 0 } } }, { "name": "lowered_bool_len1_cond_else", "provenance": { "source": "onnxruntime/test/providers/cpu/controlflow/if_test.cc", "test": "If.ConditionalBranchesOnlyContainConstantNodes_ElseBranchExecution", "notes": "Length-1 logical bool condition companion for the lowered select form; false must select the else tensor exactly." }, "inputs": { "cond": { "dtype": "bool", "shape": [1], "data": { "kind": "values", "values": [0] } }, "then_value": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [9.0, 8.0, 7.0, 6.0] } }, "else_value": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [-1.0, -2.0, -3.0, -4.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 2], "tolerance": 0 } } }, { "name": "lowered_select_else_zero_sized", "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [0] } }, "then_value": { "dtype": "float32", "shape": [0], "data": { "kind": "values", "values": [] } }, "else_value": { "dtype": "float32", "shape": [0], "data": { "kind": "values", "values": [] } } }, "outputs": { "y": { "dtype": "float32", "shape": [0] } } }, { "name": "lowered_noncanonical_cond_uint32_42_selects_then", "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [42] } }, "then_value": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [3.0, 1.5, -2.5, 0.25] } }, "else_value": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [-9.0, 7.0, 4.25, -1.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [4], "tolerance": 0 } } }, { "name": "lowered_noncanonical_cond_uint32_max_selects_then", "inputs": { "cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4294967295] } }, "then_value": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [10.0, -5.0, 0.5] } }, "else_value": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [0.0, 0.0, 0.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [3], "tolerance": 0 } } } ] }