| { |
| "op": "ai.onnx.ConstantOfShape", |
| "usageCase": "zero_default", |
| "cases": [ |
| { |
| "name": "zero_default", |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 3] } } }, |
| "outputs": { "output": { "dtype": "float32", "shape": [2, 3] } } |
| }, |
| { |
| "name": "f32_vec4_fill_4096", |
| "provenance": { |
| "notes": "Compact sibling for the f32 ConstantOfShape fill benchmark; preserves a vec4-aligned flat fill without benchmark-scale output." |
| }, |
| "attrs": { "value": -10000 }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4096] } } }, |
| "outputs": { "output": { "dtype": "float32", "shape": [4096], "tolerance": 0 } } |
| }, |
| { |
| "name": "f32_subnormal_fill_value", |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.Float_Ones", |
| "notes": "Valid float32 fill value below the normal range; the uniform-to-storage fill path must preserve finite subnormal payloads." |
| }, |
| "attrs": { "value": 1e-40 }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4] } } }, |
| "outputs": { |
| "output": { |
| "dtype": "float32", |
| "shape": [4], |
| "tolerance": 0, |
| "data": { "kind": "values", "values": [1e-40, 1e-40, 1e-40, 1e-40] } |
| } |
| } |
| }, |
| { |
| "name": "f32_positive_infinity_fill", |
| "attrs": { "value": "Infinity" }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4] } } }, |
| "outputs": { |
| "output": { |
| "dtype": "float32", |
| "shape": [4], |
| "data": { "kind": "values", "values": ["Infinity", "Infinity", "Infinity", "Infinity"] } |
| } |
| } |
| }, |
| { |
| "name": "f32_negative_infinity_fill", |
| "attrs": { "value": "-Infinity" }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [3] } } }, |
| "outputs": { |
| "output": { |
| "dtype": "float32", |
| "shape": [3], |
| "data": { "kind": "values", "values": ["-Infinity", "-Infinity", "-Infinity"] } |
| } |
| } |
| }, |
| { |
| "name": "f16_fill", |
| "attrs": { "value": 1.5 }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [1, 2, 4] } } }, |
| "outputs": { "output": { "dtype": "float16", "shape": [1, 2, 4] } }, |
| "tolerance": 0.001 |
| }, |
| { |
| "name": "scalar_output_empty_shape", |
| "attrs": { "value": -4.25 }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [0], "data": { "kind": "values", "values": [] } } }, |
| "outputs": { "output": { "dtype": "float32", "shape": [], "tolerance": 0.000001 } } |
| }, |
| { |
| "name": "rank7_output_fill", |
| "attrs": { "value": -2.75 }, |
| "inputs": { |
| "input": { "dtype": "uint32", "shape": [7], "data": { "kind": "values", "values": [1, 2, 1, 3, 1, 2, 2] } } |
| }, |
| "outputs": { "output": { "dtype": "float32", "shape": [1, 2, 1, 3, 1, 2, 2], "tolerance": 0.000001 } } |
| }, |
| { |
| "name": "zero_sized_output_fill", |
| "attrs": { "value": 6.5 }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [2, 0, 3] } } }, |
| "outputs": { "output": { "dtype": "float32", "shape": [2, 0, 3], "tolerance": 0.000001 } } |
| }, |
| { |
| "name": "ort_int32_zeros_10x6", |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.Int32_Zeros" |
| }, |
| "attrs": { "value": 0 }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [10, 6] } } }, |
| "outputs": { "output": { "dtype": "int32", "shape": [10, 6], "tolerance": 0 } } |
| }, |
| { |
| "name": "int32_negative_fill_exact", |
| "attrs": { "value": -17 }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [2, 1, 3] } } }, |
| "outputs": { "output": { "dtype": "int32", "shape": [2, 1, 3], "tolerance": 0 } } |
| }, |
| { |
| "name": "uint32_fill_exact_above_float24", |
| "attrs": { "value": 16777217 }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 3] } } }, |
| "outputs": { "output": { "dtype": "uint32", "shape": [2, 3], "tolerance": 0 } } |
| }, |
| { |
| "name": "ort_float_ones_4x3x2", |
| "attrs": { "value": 1 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.Float_Ones" |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [4, 3, 2] } } }, |
| "outputs": { "output": { "dtype": "float32", "shape": [4, 3, 2], "tolerance": 0 } } |
| }, |
| { |
| "name": "ort_default_value_float_zeros_2x6", |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.DefaultValue" |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 6] } } }, |
| "outputs": { "output": { "dtype": "float32", "shape": [2, 6], "tolerance": 0 } } |
| }, |
| { |
| "name": "ort_type_test_float16_bits_value", |
| "attrs": { "value": 2.980232238769531e-7 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.TypeTests", |
| "notes": "FLOAT16 typed value from raw bits 5, represented as its numeric half value." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 6] } } }, |
| "outputs": { "output": { "dtype": "float16", "shape": [2, 6], "tolerance": 0 } } |
| }, |
| { |
| "name": "ort_type_test_uint32_2x6", |
| "attrs": { "value": 32 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.TypeTests", |
| "notes": "UINT32 typed value." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 6] } } }, |
| "outputs": { "output": { "dtype": "uint32", "shape": [2, 6], "tolerance": 0 } } |
| }, |
| { |
| "name": "ort_type_test_int32_exact_above_float24", |
| "attrs": { "value": 20000001 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.TypeTests", |
| "notes": "INT32 typed value variant extended above f32's exact integer range." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 3] } } }, |
| "outputs": { "output": { "dtype": "int32", "shape": [2, 3], "tolerance": 0 } } |
| }, |
| { |
| "name": "ort_type_test_int16_2x6", |
| "attrs": { "value": 16 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.TypeTests", |
| "notes": "INT16 typed value from ORT's ConstantOfShape TypeTests." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 6] } } }, |
| "outputs": { "output": { "dtype": "int16", "shape": [2, 6], "tolerance": 0 } } |
| }, |
| { |
| "name": "ort_type_test_int16_min_fill", |
| "attrs": { "value": -32768 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.TypeTests", |
| "notes": "Signed int16 sentinel extension of ORT's typed ConstantOfShape TypeTests." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 3] } } }, |
| "outputs": { |
| "output": { |
| "dtype": "int16", |
| "shape": [2, 3], |
| "data": { "kind": "values", "values": [-32768, -32768, -32768, -32768, -32768, -32768] }, |
| "tolerance": 0 |
| } |
| } |
| }, |
| { |
| "name": "ort_type_test_uint32_large_exact", |
| "attrs": { "value": 4000000001 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.TypeTests", |
| "notes": "UINT32 typed value variant extended above f32's exact integer range." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 3] } } }, |
| "outputs": { "output": { "dtype": "uint32", "shape": [2, 3], "tolerance": 0 } } |
| }, |
| { |
| "name": "ort_type_test_int8_min_fill", |
| "attrs": { "value": -128 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.TypeTests", |
| "notes": "Exercises the same typed TensorProto value path as ORT's int8 TypeTests with a signed edge value." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 6] } } }, |
| "outputs": { "output": { "dtype": "int8", "shape": [2, 6], "tolerance": 0 } } |
| }, |
| { |
| "name": "ort_type_test_uint8_high_fill", |
| "attrs": { "value": 250 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.TypeTests", |
| "notes": "Exercises the same typed TensorProto value path as ORT's uint8 TypeTests with a high logical byte value." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 6] } } }, |
| "outputs": { "output": { "dtype": "uint8", "shape": [2, 6], "tolerance": 0 } } |
| }, |
| { |
| "name": "bool_true_fill", |
| "attrs": { "value": 1 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc", |
| "test": "ConstantOfShape.TypeTests", |
| "notes": "ORT source notes bool was skipped only because its C++ test harness cannot use vector<bool> as a contiguous buffer." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 3] } } }, |
| "outputs": { |
| "output": { |
| "dtype": "bool", |
| "shape": [2, 3], |
| "data": { "kind": "values", "values": [1, 1, 1, 1, 1, 1] }, |
| "tolerance": 0 |
| } |
| } |
| }, |
| { |
| "name": "onnx_backend_constantofshape_float_ones", |
| "inputs": { "input": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [4, 3, 2] } } }, |
| "outputs": { "output": { "dtype": "float32", "shape": [4, 3, 2] } }, |
| "provenance": { |
| "source": "cmake/external/onnx/onnx/backend/test/data/node/test_constantofshape_float_ones", |
| "notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable." |
| } |
| }, |
| { |
| "name": "onnx_backend_constantofshape_int_shape_zero", |
| "inputs": { "input": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [0] } } }, |
| "outputs": { "output": { "dtype": "int32", "shape": [0] } }, |
| "provenance": { |
| "source": "cmake/external/onnx/onnx/backend/test/data/node/test_constantofshape_int_shape_zero", |
| "notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable. ONNX tensor-valued value attribute represented as scalar framework value attr." |
| }, |
| "attrs": { "value": 0 } |
| }, |
| { |
| "name": "onnx_backend_constantofshape_int_zeros", |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [10, 6] } } }, |
| "outputs": { "output": { "dtype": "int32", "shape": [10, 6] } }, |
| "provenance": { |
| "source": "cmake/external/onnx/onnx/backend/test/data/node/test_constantofshape_int_zeros", |
| "notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable. ONNX tensor-valued value attribute represented as scalar framework value attr." |
| }, |
| "attrs": { "value": 0 } |
| }, |
| { |
| "name": "rank8_output_scalar_fill", |
| "attrs": { "value": 3.5 }, |
| "provenance": { |
| "source": "onnx spec: ConstantOfShape output rank = len(shape input), unbounded", |
| "notes": "Fills a rank-8 tensor with the scalar float32 value 3.5." |
| }, |
| "inputs": { |
| "input": { "dtype": "uint32", "shape": [8], "data": { "kind": "values", "values": [2, 1, 2, 1, 2, 1, 2, 1] } } |
| }, |
| "outputs": { "output": { "dtype": "float32", "shape": [2, 1, 2, 1, 2, 1, 2, 1], "tolerance": 0 } } |
| }, |
| { |
| "name": "rank8_output_oddnumel_fill", |
| "attrs": { "value": -1.25 }, |
| "provenance": { |
| "source": "onnx spec: ConstantOfShape arbitrary output rank", |
| "notes": "Rank-8 float32 fill with numel 18 (%4 != 0 -> would target the fill_float SCALAR fallback). Distinct from the vec4 case so the fix is pinned on BOTH the vec4 and the scalar fill paths. ORT CPU computes it; GPU throws because every variant gates ranks.output <= 7." |
| }, |
| "inputs": { |
| "input": { "dtype": "uint32", "shape": [8], "data": { "kind": "values", "values": [2, 1, 3, 1, 1, 3, 1, 1] } } |
| }, |
| "outputs": { "output": { "dtype": "float32", "shape": [2, 1, 3, 1, 1, 3, 1, 1], "tolerance": 0 } } |
| }, |
| { |
| "name": "f16_oddnumel_scalar_fill", |
| "attrs": { "value": -2.5 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc (TypeTests float16)", |
| "notes": "A 15-element float16 output exercises the scalar fill path because its element count is not divisible by four. The value is exactly representable in float16." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [3, 5] } } }, |
| "outputs": { "output": { "dtype": "float16", "shape": [3, 5], "tolerance": 0.001 } } |
| }, |
| { |
| "name": "u32_oddnumel_scalar_fill", |
| "attrs": { "value": 7 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc (TypeTests uint32)", |
| "notes": "Clean coverage: uint32 output with numel 15 (%4 != 0) selects the scalar branch of fill_integer. Existing uint32 cases are vec4-aligned, so this pins the scalar integer fill path." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [3, 5] } } }, |
| "outputs": { "output": { "dtype": "uint32", "shape": [3, 5], "tolerance": 0 } } |
| }, |
| { |
| "name": "int32_vec4_fill_16m_2dfold_correctness", |
| "attrs": { "value": 123456789 }, |
| "provenance": { |
| "source": "onnx spec: ConstantOfShape flat memset; 2D dispatch-fold guard", |
| "notes": "Vec4 int32 fill with numel 67108864 selects fill_integer's vectorized branch. numel/4 = 16777216 > 65535*256, so gid.y carries the high bits. Verifies the fold index+guard writes every element including the gid.y>0 region. Every element must equal 123456789." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [8192, 8192] } } }, |
| "outputs": { |
| "output": { |
| "dtype": "int32", |
| "shape": [8192, 8192], |
| "data": { "kind": "constant", "value": 123456789 }, |
| "tolerance": 0 |
| } |
| } |
| }, |
| { |
| "name": "i32_vec4_min_int32_fill_exact", |
| "attrs": { "value": -2147483648 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc (TypeTests int32) extended to INT32_MIN", |
| "notes": "Numel 8 selects fill_integer's vectorized branch. The full-width signed sentinel verifies the value is specialized as i32 with no f32 round-trip. Every element must equal -2147483648." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 4] } } }, |
| "outputs": { |
| "output": { |
| "dtype": "int32", |
| "shape": [2, 4], |
| "data": { |
| "kind": "values", |
| "values": [-2147483648, -2147483648, -2147483648, -2147483648, -2147483648, -2147483648, -2147483648, -2147483648] |
| }, |
| "tolerance": 0 |
| } |
| } |
| }, |
| { |
| "name": "u32_vec4_max_uint32_fill_exact", |
| "attrs": { "value": 4294967295 }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/generator/constant_of_shape_test.cc (TypeTests uint32) extended to UINT32_MAX", |
| "notes": "Numel 8 selects fill_integer's vectorized branch. The full-width unsigned sentinel verifies the value is specialized as u32 with no f32 round-trip (which would wrap 4294967295 to 0). Every element must equal 4294967295." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 4] } } }, |
| "outputs": { |
| "output": { |
| "dtype": "uint32", |
| "shape": [2, 4], |
| "data": { |
| "kind": "values", |
| "values": [4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295] |
| }, |
| "tolerance": 0 |
| } |
| } |
| }, |
| { |
| "name": "i32_vec4_dim1_first_zero_sized_output", |
| "attrs": { "value": -17 }, |
| "provenance": { |
| "source": "onnx spec: ConstantOfShape with a zero extent -> empty output; array<T,0> compile-crash class", |
| "notes": "shape [0,5,3] -> numel 0, dtypes.T==i32. Verifies the i32 vec4/scalar fill path does not crash on a leading-zero empty output. Existing zero_sized_output_fill covers f32 with a middle zero." |
| }, |
| "inputs": { "input": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [0, 5, 3] } } }, |
| "outputs": { "output": { "dtype": "int32", "shape": [0, 5, 3], "tolerance": 0 } } |
| } |
| ] |
| } |
|
|