| { |
| "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": "The internal lowered-select variant receives precomputed branch values; the selected then value is 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": "The internal lowered-select variant receives precomputed branch values; the selected else value is 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": "The internal lowered-select variant receives precomputed branch tensors and selects the then value." |
| }, |
| "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": "The internal lowered-select variant receives precomputed branch tensors and selects the else value." |
| }, |
| "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": "Precomputed branch tensors have different ranks but equal storage size; selecting the then tensor determines 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": "Precomputed branch tensors have different ranks but equal storage size; selecting the else tensor determines 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": "The fixed-branch select lowering accepts a scalar logical uint32 condition and chooses the complete two-element then value." |
| }, |
| "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": "A length-one logical bool condition set to false must select the else tensor exactly in the lowered-select form." |
| }, |
| "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 } } |
| } |
| ] |
| } |
|
|