Xenova HF Staff commited on
Commit
4955121
·
verified ·
1 Parent(s): 1ba8d68

sync 91d990483a17

Browse files
README.md CHANGED
@@ -12,22 +12,22 @@ tags:
12
 
13
  ## Description
14
 
15
- Reshapes the input tensor to a new shape while preserving the total number of elements. In this preallocated kernel ABI, the caller must resolve and validate the target shape—including `-1`, zero dimensions, and `allowzero`—before allocating `reshaped`; the kernel copies the elements and requires the input and output element counts to match.
16
 
17
  See the [ONNX `Reshape` spec](https://onnx.ai/onnx/operators/onnx__Reshape.html) for the reference semantics.
18
 
19
  ## Inputs
20
 
21
- | Name | Bind key | Logical dtype | WebGPU storage | Rank | Shape | Description | Presence |
22
- | --- | --- | --- | --- | --- | --- | --- | --- |
23
- | `data` | `data` | `T` | runtime-selected; narrow integers and bool use 32-bit slots | — | — | The input tensor to reshape. | required |
24
- | `shape` | `shape` | `S` | `int32` | `1` | — | Logical int64 1-D ONNX target-shape tensor, stored as int32 by WebGPU so `-1` remains representable. This standalone kernel does not inspect its values; the caller must validate them and allocate `reshaped` with the resolved shape. | required |
25
 
26
  ## Outputs
27
 
28
- | Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
29
- | --- | --- | --- | --- | --- | --- | --- |
30
- | `reshaped` | `reshaped` | `T` | derived | — | The reshaped output tensor with the caller-resolved target shape and the same elements and data type as the input. | required |
31
 
32
  ## Attributes
33
 
@@ -35,7 +35,7 @@ Default values (overridable per request):
35
 
36
  | Attribute | Default | Description |
37
  | --- | --- | --- |
38
- | `allowzero` | `0` | Controls caller-side target-shape resolution: `0` copies the corresponding input dimension for a zero entry, while `1` preserves a literal zero dimension. The standalone kernel does not interpret this attribute or the `shape` tensor. |
39
 
40
  ## Type constraints
41
 
@@ -46,7 +46,7 @@ Default values (overridable per request):
46
 
47
  ## Files
48
 
49
- - [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, provenance)
50
  - [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
51
  - [`test.json`](build/webgpu/test.json) — correctness cases
52
  - [`bench.json`](build/webgpu/bench.json) — benchmark + tuning cases
@@ -55,15 +55,18 @@ Default values (overridable per request):
55
 
56
  ## Use with `@huggingface/kernels`
57
 
58
- The loader automatically allocates outputs whose metadata it can derive from the manifest contract and this call.
 
 
59
 
60
- The explicit `outputs` entries provide shape and logical dtype metadata for the results listed below:
61
 
62
- - `reshaped`
63
 
64
- Each entry either requests an optional result or supplies metadata that cannot be inferred from the inputs.
65
 
66
  The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
 
67
 
68
  Replace each `*Data` placeholder with a typed array containing the corresponding input data.
69
 
 
12
 
13
  ## Description
14
 
15
+ Reshapes the input tensor while preserving its elements. The target shape—including `-1`, zero dimensions, and `allowzero`—must be resolved and validated before `reshaped` is allocated; input and output element counts must match.
16
 
17
  See the [ONNX `Reshape` spec](https://onnx.ai/onnx/operators/onnx__Reshape.html) for the reference semantics.
18
 
19
  ## Inputs
20
 
21
+ | Name | Logical dtype | WebGPU storage | Rank | Shape | Description | Presence |
22
+ | --- | --- | --- | --- | --- | --- | --- |
23
+ | `data` | `T` | runtime-selected; narrow integers and bool use 32-bit slots | — | — | The input tensor to reshape. | required |
24
+ | `shape` | `S` | `int32` | `1` | — | Logical int64 1-D ONNX target-shape tensor, stored as int32 by WebGPU so `-1` remains representable. The values must be validated and `reshaped` allocated with the resolved shape before dispatch. | required |
25
 
26
  ## Outputs
27
 
28
+ | Name | Logical dtype | Rank | Shape | Description | Presence |
29
+ | --- | --- | --- | --- | --- | --- |
30
+ | `reshaped` | `T` | derived | — | The output tensor with the resolved target shape and the same elements and data type as the input. | required |
31
 
32
  ## Attributes
33
 
 
35
 
36
  | Attribute | Default | Description |
37
  | --- | --- | --- |
38
+ | `allowzero` | `0` | Controls target-shape resolution: `0` copies the corresponding input dimension for a zero entry, while `1` preserves a literal zero dimension. The standalone kernel does not interpret this attribute or the `shape` tensor. |
39
 
40
  ## Type constraints
41
 
 
46
 
47
  ## Files
48
 
49
+ - [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, per-variant templates, provenance)
50
  - [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
51
  - [`test.json`](build/webgpu/test.json) — correctness cases
52
  - [`bench.json`](build/webgpu/bench.json) — benchmark + tuning cases
 
55
 
56
  ## Use with `@huggingface/kernels`
57
 
58
+ ```sh
59
+ npm install --save-exact @huggingface/kernels@0.0.1-preview.2
60
+ ```
61
 
62
+ Outputs with inferable metadata are allocated automatically. Explicit `outputs` entries request optional results or provide metadata that cannot be inferred from the supplied inputs and attributes.
63
 
64
+ This example supplies explicit metadata for:
65
 
66
+ - `reshaped`
67
 
68
  The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
69
+ It follows the `v1` branch as fixes land. To pin exact artifact bytes, pass a 40-character commit `revision` instead of `version`.
70
 
71
  Replace each `*Data` placeholder with a typed array containing the corresponding input data.
72
 
build/webgpu/bench.json CHANGED
@@ -1,5 +1,4 @@
1
  {
2
- "op": "ai.onnx.Reshape",
3
  "tunableSpace": { "WORKGROUP_SIZE": [64, 128, 256] },
4
  "cases": [
5
  {
 
1
  {
 
2
  "tunableSpace": { "WORKGROUP_SIZE": [64, 128, 256] },
3
  "cases": [
4
  {
build/webgpu/datamove-elementwise-copy.wgsl.jinja CHANGED
@@ -1,6 +1,3 @@
1
- {% if usesF16 %}
2
- enable f16;
3
- {% endif %}
4
  {{ env.wgsl.resourceDeclarations }}
5
 
6
  const WG: u32 = {{ tunables.WORKGROUP_SIZE }}u;
 
 
 
 
1
  {{ env.wgsl.resourceDeclarations }}
2
 
3
  const WG: u32 = {{ tunables.WORKGROUP_SIZE }}u;
build/webgpu/datamove-flat-copy.wgsl.jinja CHANGED
@@ -1,9 +1,6 @@
1
- {% if usesF16 %}
2
- enable f16;
3
- {% endif %}
4
  {{ env.wgsl.resourceDeclarations }}
5
 
6
- const COUNT: u32 = {{ source.count }}u;
7
  const WG: u32 = {{ tunables.WORKGROUP_SIZE }}u;
8
 
9
  @compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})
 
 
 
 
1
  {{ env.wgsl.resourceDeclarations }}
2
 
3
+ const COUNT: u32 = {{ count }}u;
4
  const WG: u32 = {{ tunables.WORKGROUP_SIZE }}u;
5
 
6
  @compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})
build/webgpu/manifest.json CHANGED
@@ -2,108 +2,63 @@
2
  "domain": "ai.onnx",
3
  "name": "Reshape",
4
  "sinceVersion": 14,
5
- "description": "Reshapes the input tensor to a new shape while preserving the total number of elements. In this preallocated kernel ABI, the caller must resolve and validate the target shape—including `-1`, zero dimensions, and `allowzero`—before allocating `reshaped`; the kernel copies the elements and requires the input and output element counts to match.",
6
- "inputs": [
7
- { "role": "data", "dtype": "T", "description": "The input tensor to reshape." },
8
- {
9
- "role": "shape",
10
- "dtype": "S",
11
- "description": "Logical int64 1-D ONNX target-shape tensor, stored as int32 by WebGPU so `-1` remains representable. This standalone kernel does not inspect its values; the caller must validate them and allocate `reshaped` with the resolved shape.",
12
- "rank": 1
13
- }
14
- ],
15
- "outputs": [
16
- {
17
- "role": "reshaped",
18
- "dtype": "T",
19
- "description": "The reshaped output tensor with the caller-resolved target shape and the same elements and data type as the input.",
20
- "rank": "dim(shapes.shape, 0)"
21
- }
22
- ],
23
- "attributes": { "allowzero": 0 },
24
- "attributeDescriptions": {
25
- "allowzero": "Controls caller-side target-shape resolution: `0` copies the corresponding input dimension for a zero entry, while `1` preserves a literal zero dimension. The standalone kernel does not interpret this attribute or the `shape` tensor."
26
  },
 
 
27
  "attributeConstraints": { "allowzero": { "values": [0, 1] } },
28
  "typeConstraints": {
29
  "T": ["float32", "float16", "int32", "int16", "uint32", "uint8", "int8", "bool"],
30
  "S": ["int64"]
31
  },
32
- "args": {
33
- "data": { "kind": "tensor", "semantic": "data", "role": "input" },
34
- "shape": { "kind": "tensor", "semantic": "shape", "role": "shape", "dtype": "int32", "narrowing": "checked" },
35
- "reshaped": { "kind": "tensor", "semantic": "reshaped", "role": "output" }
36
- },
37
- "tunables": { "WORKGROUP_SIZE": 256 },
38
  "derive": { "reshapeModeOk": "attrs.allowzero == 0 or attrs.allowzero == 1" },
39
- "constants": { "usesF16": "dtypes.T == \"f16\"" },
40
  "variants": [
41
  {
42
  "id": "copy_vec4",
43
  "priority": 20,
44
  "when": ["reshapeModeOk", "numel(shapes.data) > 0", "numel(shapes.data) % 4 == 0", "numel(shapes.data) == numel(shapes.reshaped)", "f16Ok(dtypes.T)"],
45
- "constants": { "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"" },
46
  "passes": [
47
  {
48
  "id": "main",
49
  "name": "Reshape.copyVec4",
50
- "source": { "shader": "datamove-flat-copy.wgsl.jinja", "inputs": { "count": "numel(shapes.reshaped) / 4" } },
 
51
  "bindings": [
52
- {
53
- "name": "src",
54
- "arg": "data",
55
- "semantic": "data",
56
- "buffer": { "type": "read-only-storage" },
57
- "elementType": "$vectorScalar"
58
- },
59
- {
60
- "name": "dst",
61
- "arg": "reshaped",
62
- "semantic": "reshaped",
63
- "buffer": { "type": "storage" },
64
- "elementType": "$vectorScalar"
65
- }
66
  ],
67
- "dispatch": { "gridStride": "numel(shapes.reshaped) / 4", "workgroupSize": "tunables.WORKGROUP_SIZE" },
 
 
 
 
68
  "viewAlias": [{ "input": "src", "output": "dst" }]
69
  }
70
  ]
71
  },
72
  {
73
  "id": "copy",
74
- "when": "reshapeModeOk and numel(shapes.data) == numel(shapes.reshaped) and f16Ok(dtypes.T)",
75
- "constants": { "scalar": "dtypes.T" },
76
  "passes": [
77
  {
78
  "id": "main",
79
  "name": "Reshape",
80
  "shader": "datamove-elementwise-copy.wgsl.jinja",
81
  "bindings": [
82
- {
83
- "name": "x",
84
- "arg": "data",
85
- "semantic": "data",
86
- "buffer": { "type": "read-only-storage" },
87
- "elementType": "$scalar"
88
- },
89
- {
90
- "name": "y",
91
- "arg": "reshaped",
92
- "semantic": "reshaped",
93
- "buffer": { "type": "storage" },
94
- "elementType": "$scalar"
95
- },
96
- {
97
- "name": "params",
98
- "semantic": "kernel.params",
99
- "buffer": { "type": "uniform" },
100
- "struct": {
101
- "name": "Params",
102
- "fields": [{ "name": "count", "type": "u32", "value": "numel(shapes.reshaped)" }]
103
- }
104
- }
105
  ],
106
- "dispatch": { "gridStride": "numel(shapes.reshaped)", "workgroupSize": "tunables.WORKGROUP_SIZE" },
 
 
 
 
107
  "viewAlias": [{ "input": "x", "output": "y" }]
108
  }
109
  ]
 
2
  "domain": "ai.onnx",
3
  "name": "Reshape",
4
  "sinceVersion": 14,
5
+ "inputs": {
6
+ "data": { "dtype": "T" },
7
+ "shape": { "dtype": "S", "rank": 1, "storage": "int32", "narrowing": "checked" }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  },
9
+ "outputs": { "reshaped": { "dtype": "T", "rank": "dim(shapes.shape, 0)" } },
10
+ "attributes": { "allowzero": { "default": 0 } },
11
  "attributeConstraints": { "allowzero": { "values": [0, 1] } },
12
  "typeConstraints": {
13
  "T": ["float32", "float16", "int32", "int16", "uint32", "uint8", "int8", "bool"],
14
  "S": ["int64"]
15
  },
16
+ "tunables": { "WORKGROUP_SIZE": { "default": 256 } },
 
 
 
 
 
17
  "derive": { "reshapeModeOk": "attrs.allowzero == 0 or attrs.allowzero == 1" },
 
18
  "variants": [
19
  {
20
  "id": "copy_vec4",
21
  "priority": 20,
22
  "when": ["reshapeModeOk", "numel(shapes.data) > 0", "numel(shapes.data) % 4 == 0", "numel(shapes.data) == numel(shapes.reshaped)", "f16Ok(dtypes.T)"],
23
+ "derive": { "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"" },
24
  "passes": [
25
  {
26
  "id": "main",
27
  "name": "Reshape.copyVec4",
28
+ "shader": "datamove-flat-copy.wgsl.jinja",
29
+ "derive": { "count": "numel(shapes.reshaped) / 4" },
30
  "bindings": [
31
+ { "arg": "data", "name": "src", "elementType": "$vectorScalar" },
32
+ { "arg": "reshaped", "name": "dst", "elementType": "$vectorScalar" }
 
 
 
 
 
 
 
 
 
 
 
 
33
  ],
34
+ "dispatch": {
35
+ "x": "min(ceilDiv((numel(shapes.reshaped) / 4), (tunables.WORKGROUP_SIZE)), min(device.limits.maxComputeWorkgroupsPerDimension, 65535))",
36
+ "y": 1,
37
+ "z": 1
38
+ },
39
  "viewAlias": [{ "input": "src", "output": "dst" }]
40
  }
41
  ]
42
  },
43
  {
44
  "id": "copy",
45
+ "when": ["reshapeModeOk and numel(shapes.data) == numel(shapes.reshaped) and f16Ok(dtypes.T)"],
46
+ "derive": { "scalar": "dtypes.T" },
47
  "passes": [
48
  {
49
  "id": "main",
50
  "name": "Reshape",
51
  "shader": "datamove-elementwise-copy.wgsl.jinja",
52
  "bindings": [
53
+ { "arg": "data", "name": "x", "elementType": "$scalar" },
54
+ { "arg": "reshaped", "name": "y", "elementType": "$scalar" },
55
+ { "name": "params", "struct": [{ "name": "count", "type": "u32", "value": "numel(shapes.reshaped)" }] }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  ],
57
+ "dispatch": {
58
+ "x": "min(ceilDiv((numel(shapes.reshaped)), (tunables.WORKGROUP_SIZE)), min(device.limits.maxComputeWorkgroupsPerDimension, 65535))",
59
+ "y": 1,
60
+ "z": 1
61
+ },
62
  "viewAlias": [{ "input": "x", "output": "y" }]
63
  }
64
  ]
build/webgpu/metadata.json CHANGED
@@ -1,19 +1,22 @@
1
  {
2
  "name": "ai.onnx.Reshape",
3
- "id": "_ai_onnx_reshape_webgpu_65ee152",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "backend": { "type": "webgpu" },
7
  "digest": {
8
  "algorithm": "sha256",
9
  "files": {
10
- "bench.json": "69A1NMlREheggpSNj8htmManeB/z0HH/QNeacSzURGI=",
11
- "datamove-elementwise-copy.wgsl.jinja": "J5yC2bAddPiP+odXLgVGS3TJ9jeNsfRTvedKrj/fhZg=",
12
- "datamove-flat-copy.wgsl.jinja": "rEpeYMvIZQuQnB2f3lt51jrrklKICsqUTzCJPRTknNk=",
13
- "manifest.json": "61gkdCMoUp39wr9rBxQ0oncJwE5qd9Az+fRQDDEOGB0=",
14
- "test.json": "+cht0hPHFoAOvZ6pfI97ReMTuoOgC0MZRnnXDu4549c="
15
  }
16
  },
17
- "provenance": { "kernel": { "sha": "2e7068faf55e7f43df740015f6d1ee49391a41c5", "dirty": false } },
18
- "webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.Reshape" }
 
 
 
19
  }
 
1
  {
2
  "name": "ai.onnx.Reshape",
3
+ "id": "_ai_onnx_reshape_webgpu_c55e31e",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "backend": { "type": "webgpu" },
7
  "digest": {
8
  "algorithm": "sha256",
9
  "files": {
10
+ "bench.json": "AAAfqBx6yJ8rtDAPF9mbztPnteMhWDLHiIiJJf1Mc9U=",
11
+ "datamove-elementwise-copy.wgsl.jinja": "Q1WuZCqcDf9b6cbT4rLilpeWj6327t/bSFmKr6IVBoQ=",
12
+ "datamove-flat-copy.wgsl.jinja": "g9d62mer2bmHfbScqX5CIT5Zq/Pdinac0W2dH0CD+5s=",
13
+ "manifest.json": "WrN4wPoSc9+xsh3es62hMt0yDgsN3Pl+4f//L/X0X4s=",
14
+ "test.json": "1XC5Gsp15I4tUcAsnBJkDezeVpvO/Pm+10uzzDJtedY="
15
  }
16
  },
17
+ "provenance": { "kernel": { "sha": "91d990483a174128daf7673f3f37a7c890493ae1", "dirty": false } },
18
+ "webgpu": {
19
+ "manifestSpec": "2.0",
20
+ "variants": { "copy_vec4": ["datamove-flat-copy.wgsl.jinja"], "copy": ["datamove-elementwise-copy.wgsl.jinja"] }
21
+ }
22
  }
build/webgpu/test.json CHANGED
@@ -1,5 +1,4 @@
1
  {
2
- "op": "ai.onnx.Reshape",
3
  "fixtureArrays": {
4
  "onnx_backend_input_data": [0.54881352186203, 0.7151893377304077, 0.6027633547782898, 0.5448831915855408, 0.42365479469299316, 0.6458941102027893, 0.4375872015953064, 0.891772985458374, 0.9636627435684204, 0.3834415078163147, 0.7917250394821167, 0.5288949012756348, 0.5680445432662964, 0.9255966544151306, 0.07103605568408966, 0.08712930232286453, 0.020218396559357643, 0.832619845867157, 0.7781567573547363, 0.8700121641159058, 0.978618323802948, 0.7991585731506348, 0.4614793658256531, 0.7805292010307312]
5
  },
@@ -202,7 +201,7 @@
202
  "provenance": {
203
  "source": "onnxruntime/test/providers/cpu/tensor/tensor_op_test.cc",
204
  "test": "TensorOpTest.Reshape",
205
- "notes": "Same shape transform as ORT's basic Reshape test, using supported int32 data storage."
206
  },
207
  "inputs": {
208
  "data": { "dtype": "int32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 2, 3, 4, 5, 6] } },
@@ -215,7 +214,7 @@
215
  "provenance": {
216
  "source": "onnxruntime/test/providers/cpu/tensor/tensor_op_test.cc",
217
  "test": "TensorOpTest.Reshape_UnknownDimWithoutAllowZero",
218
- "notes": "ONNX int64 shape tensor represented with framework int32 slots."
219
  },
220
  "inputs": {
221
  "data": {
@@ -232,7 +231,7 @@
232
  "provenance": {
233
  "source": "onnxruntime/test/providers/cpu/tensor/tensor_op_test.cc",
234
  "test": "TensorOpTest.ReshapeWithEmptyInputAndDynamicShape",
235
- "notes": "The ORT success subcase reshapes {1,0} using {1,1,-1} to {1,1,0}; the sibling {1,0,-1} case is an expected failure and is not encoded here."
236
  },
237
  "inputs": {
238
  "data": { "dtype": "float32", "shape": [1, 0], "data": { "kind": "values", "values": [] } },
@@ -249,7 +248,7 @@
249
  "outputs": { "reshaped": { "dtype": "float32", "shape": [3, 4, 0] } },
250
  "provenance": {
251
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_allowzero_reordered",
252
- "notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable. ONNX Runtime validates `allowzero=1` and resolves `[3, 4, 0]`; the standalone WebGPU copy consumes the caller-preallocated `[3, 4, 0]` output and does not inspect the shape tensor."
253
  },
254
  "attrs": { "allowzero": 1 }
255
  },
@@ -266,7 +265,7 @@
266
  "outputs": { "reshaped": { "dtype": "float32", "shape": [2, 3, 2, 2] } },
267
  "provenance": {
268
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_extended_dims",
269
- "notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable."
270
  }
271
  },
272
  {
@@ -282,7 +281,7 @@
282
  "outputs": { "reshaped": { "dtype": "float32", "shape": [24] } },
283
  "provenance": {
284
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_one_dim",
285
- "notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable."
286
  }
287
  },
288
  {
@@ -298,7 +297,7 @@
298
  "outputs": { "reshaped": { "dtype": "float32", "shape": [2, 12] } },
299
  "provenance": {
300
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_reduced_dims",
301
- "notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable."
302
  }
303
  },
304
  {
@@ -314,7 +313,7 @@
314
  "outputs": { "reshaped": { "dtype": "float32", "shape": [4, 2, 3] } },
315
  "provenance": {
316
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_reordered_all_dims",
317
- "notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable."
318
  }
319
  },
320
  {
@@ -330,7 +329,7 @@
330
  "outputs": { "reshaped": { "dtype": "float32", "shape": [2, 4, 3] } },
331
  "provenance": {
332
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_reordered_last_dims",
333
- "notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable."
334
  }
335
  },
336
  {
@@ -346,14 +345,14 @@
346
  "outputs": { "reshaped": { "dtype": "float32", "shape": [2, 3, 4, 1] } },
347
  "provenance": {
348
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_zero_dim",
349
- "notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable."
350
  }
351
  },
352
  {
353
  "name": "onnx_backend_negative_dim_infer_middle",
354
  "provenance": {
355
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_negative_dim",
356
- "notes": "Official shape tensor is int64; this framework stores signed Reshape metadata as int32."
357
  },
358
  "inputs": {
359
  "data": {
@@ -369,7 +368,7 @@
369
  "name": "onnx_backend_negative_dim_infer_leading",
370
  "provenance": {
371
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_negative_extended_dims",
372
- "notes": "Official shape tensor is int64; this framework stores signed Reshape metadata as int32."
373
  },
374
  "inputs": {
375
  "data": {
@@ -385,7 +384,7 @@
385
  "name": "onnx_backend_zero_copy_and_negative_dim",
386
  "provenance": {
387
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_zero_and_negative_dim",
388
- "notes": "Official shape tensor is int64; this framework stores signed Reshape metadata as int32."
389
  },
390
  "inputs": {
391
  "data": {
 
1
  {
 
2
  "fixtureArrays": {
3
  "onnx_backend_input_data": [0.54881352186203, 0.7151893377304077, 0.6027633547782898, 0.5448831915855408, 0.42365479469299316, 0.6458941102027893, 0.4375872015953064, 0.891772985458374, 0.9636627435684204, 0.3834415078163147, 0.7917250394821167, 0.5288949012756348, 0.5680445432662964, 0.9255966544151306, 0.07103605568408966, 0.08712930232286453, 0.020218396559357643, 0.832619845867157, 0.7781567573547363, 0.8700121641159058, 0.978618323802948, 0.7991585731506348, 0.4614793658256531, 0.7805292010307312]
4
  },
 
201
  "provenance": {
202
  "source": "onnxruntime/test/providers/cpu/tensor/tensor_op_test.cc",
203
  "test": "TensorOpTest.Reshape",
204
+ "notes": "A basic Reshape transform uses supported int32 payload storage."
205
  },
206
  "inputs": {
207
  "data": { "dtype": "int32", "shape": [2, 3], "data": { "kind": "values", "values": [1, 2, 3, 4, 5, 6] } },
 
214
  "provenance": {
215
  "source": "onnxruntime/test/providers/cpu/tensor/tensor_op_test.cc",
216
  "test": "TensorOpTest.Reshape_UnknownDimWithoutAllowZero",
217
+ "notes": "The int32 shape tensor exactly represents the source ONNX int64 values."
218
  },
219
  "inputs": {
220
  "data": {
 
231
  "provenance": {
232
  "source": "onnxruntime/test/providers/cpu/tensor/tensor_op_test.cc",
233
  "test": "TensorOpTest.ReshapeWithEmptyInputAndDynamicShape",
234
+ "notes": "Input shape {1,0} with requested shape {1,1,-1} infers the zero-length dimension and produces {1,1,0}."
235
  },
236
  "inputs": {
237
  "data": { "dtype": "float32", "shape": [1, 0], "data": { "kind": "values", "values": [] } },
 
248
  "outputs": { "reshaped": { "dtype": "float32", "shape": [3, 4, 0] } },
249
  "provenance": {
250
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_allowzero_reordered",
251
+ "notes": "The integer shape tensor exactly represents the source ONNX int64 values. With `allowzero=1`, the declared output shape is [3,4,0], so the empty copy performs no element reads."
252
  },
253
  "attrs": { "allowzero": 1 }
254
  },
 
265
  "outputs": { "reshaped": { "dtype": "float32", "shape": [2, 3, 2, 2] } },
266
  "provenance": {
267
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_extended_dims",
268
+ "notes": "The integer shape tensor exactly represents the source ONNX int64 values."
269
  }
270
  },
271
  {
 
281
  "outputs": { "reshaped": { "dtype": "float32", "shape": [24] } },
282
  "provenance": {
283
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_one_dim",
284
+ "notes": "The integer shape tensor exactly represents the source ONNX int64 values."
285
  }
286
  },
287
  {
 
297
  "outputs": { "reshaped": { "dtype": "float32", "shape": [2, 12] } },
298
  "provenance": {
299
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_reduced_dims",
300
+ "notes": "The integer shape tensor exactly represents the source ONNX int64 values."
301
  }
302
  },
303
  {
 
313
  "outputs": { "reshaped": { "dtype": "float32", "shape": [4, 2, 3] } },
314
  "provenance": {
315
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_reordered_all_dims",
316
+ "notes": "The integer shape tensor exactly represents the source ONNX int64 values."
317
  }
318
  },
319
  {
 
329
  "outputs": { "reshaped": { "dtype": "float32", "shape": [2, 4, 3] } },
330
  "provenance": {
331
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_reordered_last_dims",
332
+ "notes": "The integer shape tensor exactly represents the source ONNX int64 values."
333
  }
334
  },
335
  {
 
345
  "outputs": { "reshaped": { "dtype": "float32", "shape": [2, 3, 4, 1] } },
346
  "provenance": {
347
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_zero_dim",
348
+ "notes": "The integer shape tensor exactly represents the source ONNX int64 values."
349
  }
350
  },
351
  {
352
  "name": "onnx_backend_negative_dim_infer_middle",
353
  "provenance": {
354
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_negative_dim",
355
+ "notes": "Projects signed int64 shape metadata to int32 storage."
356
  },
357
  "inputs": {
358
  "data": {
 
368
  "name": "onnx_backend_negative_dim_infer_leading",
369
  "provenance": {
370
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_negative_extended_dims",
371
+ "notes": "Projects signed int64 shape metadata to int32 storage."
372
  },
373
  "inputs": {
374
  "data": {
 
384
  "name": "onnx_backend_zero_copy_and_negative_dim",
385
  "provenance": {
386
  "source": "cmake/external/onnx/onnx/backend/test/data/node/test_reshape_zero_and_negative_dim",
387
+ "notes": "Projects signed int64 shape metadata to int32 storage."
388
  },
389
  "inputs": {
390
  "data": {