Xenova HF Staff commited on
Commit
c3bbe43
·
verified ·
1 Parent(s): a08c66f

sync 2e7068faf55e

Browse files
README.md CHANGED
@@ -1,3 +1,87 @@
1
  ---
 
2
  license: apache-2.0
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ library_name: kernels
3
  license: apache-2.0
4
+ tags:
5
+ - kernel
6
+ - webgpu
7
+ - wgsl
8
  ---
9
+ # ai.onnx.SplitToSequence
10
+
11
+ `ai.onnx` · internal tensor lowering (non-standard) · reviewed against ONNX opset 11
12
+
13
+ ## Description
14
+
15
+ Support status: the standard ONNX `SplitToSequence` operator is not implemented because this kernel ABI exposes tensors rather than an ONNX sequence value. This internal lowering copies an input into two, three, four, or six caller-shaped tensor outputs and therefore does not implement the standard `output_sequence` contract; it must not be treated as ONNX `SplitToSequence`.
16
+
17
+ See the [standard ONNX `SplitToSequence` spec](https://onnx.ai/onnx/operators/onnx__SplitToSequence.html) for the contract this internal lowering does not implement.
18
+
19
+ ## Inputs
20
+
21
+ | Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
22
+ | --- | --- | --- | --- | --- | --- | --- |
23
+ | `input` | `input` | `T` | — | — | The tensor to split. | required |
24
+ | `split` | `split` | `S` | — | — | Length of each output slice: a scalar for uniform chunks or a 1-D tensor of per-output lengths. | optional |
25
+
26
+ ## Outputs
27
+
28
+ | Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
29
+ | --- | --- | --- | --- | --- | --- | --- |
30
+ | `Y0` | `y0` | `T` | derived | — | First output tensor slice. | required |
31
+ | `Y1` | `y1` | `T` | derived | — | Second output tensor slice. | required |
32
+ | `Y2` | `y2` | `T` | derived | — | Third output tensor slice. | optional |
33
+ | `Y3` | `y3` | `T` | derived | — | Fourth output tensor slice. | optional |
34
+ | `Y4` | `y4` | `T` | derived | — | Fifth output tensor slice. | optional |
35
+ | `Y5` | `y5` | `T` | derived | — | Sixth output tensor slice. | optional |
36
+
37
+ ## Attributes
38
+
39
+ Default values (overridable per request):
40
+
41
+ | Attribute | Default | Description |
42
+ | --- | --- | --- |
43
+ | `axis` | `0` | Axis along which to split; negative values count from the back. Accepted range is `[-rank, rank-1]`. |
44
+ | `keepdims` | `1` | Whether to keep the split dimension in the output (default `1`). Ignored when `split` is provided. |
45
+
46
+ ## Type constraints
47
+
48
+ | Variable | Allowed dtypes |
49
+ | --- | --- |
50
+ | `T` | `float32`, `float16`, `bool` |
51
+ | `S` | `uint32` |
52
+
53
+ ## Files
54
+
55
+ - [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, provenance)
56
+ - [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
57
+ - [`test.json`](build/webgpu/test.json) — correctness cases
58
+ - [`bench.json`](build/webgpu/bench.json) — benchmark + tuning cases
59
+ - [`split-to-sequence.wgsl.jinja`](build/webgpu/split-to-sequence.wgsl.jinja)
60
+
61
+ ## Use with `@huggingface/kernels`
62
+
63
+ The loader automatically allocates outputs whose metadata it can derive from the manifest contract and this call.
64
+
65
+ The explicit `outputs` entries provide shape and logical dtype metadata for the results listed below:
66
+
67
+ - `y0`
68
+ - `y1`
69
+
70
+ Each entry either requests an optional result or supplies metadata that cannot be inferred from the inputs.
71
+
72
+ The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
73
+
74
+ Replace each `*Data` placeholder with a typed array containing the corresponding input data.
75
+
76
+ ```js
77
+ import { getKernel } from "@huggingface/kernels";
78
+
79
+ const kernel = await getKernel("webgpu-kernels/ai.onnx.SplitToSequence", { version: 1 });
80
+ // Explicit destinations request optional results or supply metadata that cannot be inferred.
81
+ const { y0, y1 } = await kernel({ input: { data: inputData, shape: [3, 2] } }, {
82
+ outputs: {
83
+ y0: { shape: [1, 2], dtype: "float32" },
84
+ y1: { shape: [1, 2], dtype: "float32" },
85
+ },
86
+ });
87
+ ```
build/webgpu/bench.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "op": "ai.onnx.SplitToSequence",
3
+ "cases": [
4
+ {
5
+ "name": "split3-1536x256-f32",
6
+ "attrs": { "axis": 0 },
7
+ "inputs": {
8
+ "input": { "dtype": "float32", "shape": [1536, 256] },
9
+ "split": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [512, 512, 512] } }
10
+ },
11
+ "outputs": {
12
+ "y0": { "dtype": "float32", "shape": [512, 256] },
13
+ "y1": { "dtype": "float32", "shape": [512, 256] },
14
+ "y2": { "dtype": "float32", "shape": [512, 256] }
15
+ },
16
+ "preset": "smoke"
17
+ },
18
+ {
19
+ "name": "rank6_squeeze_six_outputs_addr_arith_f32_stress",
20
+ "preset": "stress",
21
+ "attrs": { "axis": 1, "keepdims": 0 },
22
+ "inputs": {
23
+ "input": { "dtype": "float32", "shape": [8, 6, 4, 4, 16, 64], "dist": "normal", "seed": 1234, "scale": 2 },
24
+ "split": { "dtype": "uint32", "shape": [], "dist": "constant", "value": 1 }
25
+ },
26
+ "outputs": {
27
+ "y0": { "dtype": "float32", "shape": [8, 4, 4, 16, 64], "dist": "empty" },
28
+ "y1": { "dtype": "float32", "shape": [8, 4, 4, 16, 64], "dist": "empty" },
29
+ "y2": { "dtype": "float32", "shape": [8, 4, 4, 16, 64], "dist": "empty" },
30
+ "y3": { "dtype": "float32", "shape": [8, 4, 4, 16, 64], "dist": "empty" },
31
+ "y4": { "dtype": "float32", "shape": [8, 4, 4, 16, 64], "dist": "empty" },
32
+ "y5": { "dtype": "float32", "shape": [8, 4, 4, 16, 64], "dist": "empty" }
33
+ },
34
+ "bench": {
35
+ "primary": true,
36
+ "metrics": [
37
+ { "type": "elements", "value": "numel(shapes.input)" },
38
+ { "type": "bandwidth", "value": "numel(shapes.input)*4*2", "unit": "GB/s" }
39
+ ]
40
+ }
41
+ }
42
+ ]
43
+ }
build/webgpu/manifest.json ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "domain": "ai.onnx",
3
+ "name": "SplitToSequence",
4
+ "conformance": "internal-lowering",
5
+ "sinceVersion": 11,
6
+ "description": "Support status: the standard ONNX `SplitToSequence` operator is not implemented because this kernel ABI exposes tensors rather than an ONNX sequence value. This internal lowering copies an input into two, three, four, or six caller-shaped tensor outputs and therefore does not implement the standard `output_sequence` contract; it must not be treated as ONNX `SplitToSequence`.",
7
+ "inputs": [
8
+ { "role": "input", "dtype": "T", "description": "The tensor to split." },
9
+ {
10
+ "role": "split",
11
+ "dtype": "S",
12
+ "optional": true,
13
+ "description": "Length of each output slice: a scalar for uniform chunks or a 1-D tensor of per-output lengths."
14
+ }
15
+ ],
16
+ "outputs": [
17
+ {
18
+ "role": "Y0",
19
+ "dtype": "T",
20
+ "description": "First output tensor slice.",
21
+ "rank": "ranks.input if attrs.keepdims == 1 else ranks.input - 1"
22
+ },
23
+ {
24
+ "role": "Y1",
25
+ "dtype": "T",
26
+ "description": "Second output tensor slice.",
27
+ "rank": "ranks.input if attrs.keepdims == 1 else ranks.input - 1"
28
+ },
29
+ {
30
+ "role": "Y2",
31
+ "dtype": "T",
32
+ "optional": true,
33
+ "description": "Third output tensor slice.",
34
+ "rank": "ranks.input if attrs.keepdims == 1 else ranks.input - 1"
35
+ },
36
+ {
37
+ "role": "Y3",
38
+ "dtype": "T",
39
+ "optional": true,
40
+ "description": "Fourth output tensor slice.",
41
+ "rank": "ranks.input if attrs.keepdims == 1 else ranks.input - 1"
42
+ },
43
+ {
44
+ "role": "Y4",
45
+ "dtype": "T",
46
+ "optional": true,
47
+ "description": "Fifth output tensor slice.",
48
+ "rank": "ranks.input if attrs.keepdims == 1 else ranks.input - 1"
49
+ },
50
+ {
51
+ "role": "Y5",
52
+ "dtype": "T",
53
+ "optional": true,
54
+ "description": "Sixth output tensor slice.",
55
+ "rank": "ranks.input if attrs.keepdims == 1 else ranks.input - 1"
56
+ }
57
+ ],
58
+ "attributes": { "axis": 0, "keepdims": 1 },
59
+ "attributeDescriptions": {
60
+ "axis": "Axis along which to split; negative values count from the back. Accepted range is `[-rank, rank-1]`.",
61
+ "keepdims": "Whether to keep the split dimension in the output (default `1`). Ignored when `split` is provided."
62
+ },
63
+ "attributeConstraints": { "keepdims": { "values": [0, 1] } },
64
+ "typeConstraints": { "T": ["float32", "float16", "bool"], "S": ["uint32"] },
65
+ "args": {
66
+ "input": { "kind": "tensor", "semantic": "input", "role": "input" },
67
+ "split": { "kind": "tensor", "semantic": "split", "role": "split", "required": false },
68
+ "y0": { "kind": "tensor", "semantic": "Y0", "role": "output0" },
69
+ "y1": { "kind": "tensor", "semantic": "Y1", "role": "output1" },
70
+ "y2": { "kind": "tensor", "semantic": "Y2", "role": "output2", "required": false },
71
+ "y3": { "kind": "tensor", "semantic": "Y3", "role": "output3", "required": false },
72
+ "y4": { "kind": "tensor", "semantic": "Y4", "role": "output4", "required": false },
73
+ "y5": { "kind": "tensor", "semantic": "Y5", "role": "output5", "required": false }
74
+ },
75
+ "tunables": { "WORKGROUP_SIZE": 256 },
76
+ "derive": {
77
+ "baseContract": "ranks.input >= 1 and (attrs.axis if attrs.axis >= 0 else attrs.axis + ranks.input) >= 0 and (attrs.axis if attrs.axis >= 0 else attrs.axis + ranks.input) < ranks.input and f16Ok(dtypes.T)",
78
+ "outputRankContract": "ranks.Y0 == ranks.input if present.split else (ranks.Y0 == ranks.input if attrs.keepdims == 1 else ranks.Y0 == ranks.input - 1)",
79
+ "twoOutputContract": "baseContract and not present.y2 and ranks.Y0 == ranks.Y1 and outputRankContract",
80
+ "threeOutputContract": "baseContract and present.y2 and not present.y3 and ranks.Y0 == ranks.Y1 and ranks.Y0 == ranks.Y2 and outputRankContract",
81
+ "fourOutputContract": "baseContract and present.y2 and present.y3 and not present.y4 and ranks.Y0 == ranks.Y1 and ranks.Y0 == ranks.Y2 and ranks.Y0 == ranks.Y3 and outputRankContract",
82
+ "sixOutputContract": "baseContract and present.y2 and present.y3 and present.y4 and present.y5 and ranks.Y0 == ranks.Y1 and ranks.Y0 == ranks.Y2 and ranks.Y0 == ranks.Y3 and ranks.Y0 == ranks.Y4 and ranks.Y0 == ranks.Y5 and outputRankContract"
83
+ },
84
+ "constants": { "scalar": "dtypes.T", "usesF16": "dtypes.T == \"f16\"" },
85
+ "variants": [
86
+ {
87
+ "id": "two_outputs",
88
+ "when": ["twoOutputContract"],
89
+ "passes": [
90
+ {
91
+ "id": "main",
92
+ "name": "SplitToSequence2",
93
+ "source": {
94
+ "shader": "split-to-sequence.wgsl.jinja",
95
+ "inputs": {
96
+ "inputShape": "shapes.input",
97
+ "rank": "ranks.input",
98
+ "axis": "attrs.axis if attrs.axis >= 0 else attrs.axis + ranks.input",
99
+ "squeeze": "ranks.Y0 < ranks.input",
100
+ "numOutputs": "2",
101
+ "outShapes": ["shapes.Y0", "shapes.Y1"]
102
+ }
103
+ },
104
+ "bindings": [
105
+ {
106
+ "name": "input",
107
+ "arg": "input",
108
+ "semantic": "input",
109
+ "buffer": { "type": "read-only-storage" },
110
+ "elementType": "$scalar"
111
+ },
112
+ { "name": "y0", "arg": "y0", "semantic": "Y0", "buffer": { "type": "storage" }, "elementType": "$scalar" },
113
+ { "name": "y1", "arg": "y1", "semantic": "Y1", "buffer": { "type": "storage" }, "elementType": "$scalar" },
114
+ {
115
+ "name": "params",
116
+ "semantic": "kernel.params",
117
+ "buffer": { "type": "uniform" },
118
+ "struct": {
119
+ "name": "Params",
120
+ "fields": [
121
+ { "name": "y0Count", "type": "u32", "value": "numel(shapes.Y0)" },
122
+ { "name": "y1Count", "type": "u32", "value": "numel(shapes.Y1)" }
123
+ ]
124
+ }
125
+ }
126
+ ],
127
+ "dispatch": {
128
+ "threads": "max(numel(shapes.Y0), numel(shapes.Y1))",
129
+ "workgroupSize": "tunables.WORKGROUP_SIZE"
130
+ }
131
+ }
132
+ ]
133
+ },
134
+ {
135
+ "id": "three_outputs",
136
+ "priority": 20,
137
+ "when": ["threeOutputContract"],
138
+ "passes": [
139
+ {
140
+ "id": "main",
141
+ "name": "SplitToSequence3",
142
+ "source": {
143
+ "shader": "split-to-sequence.wgsl.jinja",
144
+ "inputs": {
145
+ "inputShape": "shapes.input",
146
+ "rank": "ranks.input",
147
+ "axis": "attrs.axis if attrs.axis >= 0 else attrs.axis + ranks.input",
148
+ "squeeze": "ranks.Y0 < ranks.input",
149
+ "numOutputs": "3",
150
+ "outShapes": ["shapes.Y0", "shapes.Y1", "shapes.Y2"]
151
+ }
152
+ },
153
+ "bindings": [
154
+ {
155
+ "name": "input",
156
+ "arg": "input",
157
+ "semantic": "input",
158
+ "buffer": { "type": "read-only-storage" },
159
+ "elementType": "$scalar"
160
+ },
161
+ { "name": "y0", "arg": "y0", "semantic": "Y0", "buffer": { "type": "storage" }, "elementType": "$scalar" },
162
+ { "name": "y1", "arg": "y1", "semantic": "Y1", "buffer": { "type": "storage" }, "elementType": "$scalar" },
163
+ { "name": "y2", "arg": "y2", "semantic": "Y2", "buffer": { "type": "storage" }, "elementType": "$scalar" },
164
+ {
165
+ "name": "params",
166
+ "semantic": "kernel.params",
167
+ "buffer": { "type": "uniform" },
168
+ "struct": {
169
+ "name": "Params",
170
+ "fields": [
171
+ { "name": "y0Count", "type": "u32", "value": "numel(shapes.Y0)" },
172
+ { "name": "y1Count", "type": "u32", "value": "numel(shapes.Y1)" },
173
+ { "name": "y2Count", "type": "u32", "value": "numel(shapes.Y2)" }
174
+ ]
175
+ }
176
+ }
177
+ ],
178
+ "dispatch": {
179
+ "threads": "max(max(numel(shapes.Y0), numel(shapes.Y1)), numel(shapes.Y2))",
180
+ "workgroupSize": "tunables.WORKGROUP_SIZE"
181
+ }
182
+ }
183
+ ]
184
+ },
185
+ {
186
+ "id": "four_outputs",
187
+ "priority": 30,
188
+ "when": ["fourOutputContract"],
189
+ "passes": [
190
+ {
191
+ "id": "main",
192
+ "name": "SplitToSequence4",
193
+ "source": {
194
+ "shader": "split-to-sequence.wgsl.jinja",
195
+ "inputs": {
196
+ "inputShape": "shapes.input",
197
+ "rank": "ranks.input",
198
+ "axis": "attrs.axis if attrs.axis >= 0 else attrs.axis + ranks.input",
199
+ "squeeze": "ranks.Y0 < ranks.input",
200
+ "numOutputs": "4",
201
+ "outShapes": ["shapes.Y0", "shapes.Y1", "shapes.Y2", "shapes.Y3"]
202
+ }
203
+ },
204
+ "bindings": [
205
+ {
206
+ "name": "input",
207
+ "arg": "input",
208
+ "semantic": "input",
209
+ "buffer": { "type": "read-only-storage" },
210
+ "elementType": "$scalar"
211
+ },
212
+ { "name": "y0", "arg": "y0", "semantic": "Y0", "buffer": { "type": "storage" }, "elementType": "$scalar" },
213
+ { "name": "y1", "arg": "y1", "semantic": "Y1", "buffer": { "type": "storage" }, "elementType": "$scalar" },
214
+ { "name": "y2", "arg": "y2", "semantic": "Y2", "buffer": { "type": "storage" }, "elementType": "$scalar" },
215
+ { "name": "y3", "arg": "y3", "semantic": "Y3", "buffer": { "type": "storage" }, "elementType": "$scalar" },
216
+ {
217
+ "name": "params",
218
+ "semantic": "kernel.params",
219
+ "buffer": { "type": "uniform" },
220
+ "struct": {
221
+ "name": "Params",
222
+ "fields": [
223
+ { "name": "y0Count", "type": "u32", "value": "numel(shapes.Y0)" },
224
+ { "name": "y1Count", "type": "u32", "value": "numel(shapes.Y1)" },
225
+ { "name": "y2Count", "type": "u32", "value": "numel(shapes.Y2)" },
226
+ { "name": "y3Count", "type": "u32", "value": "numel(shapes.Y3)" }
227
+ ]
228
+ }
229
+ }
230
+ ],
231
+ "dispatch": {
232
+ "threads": "max(max(max(numel(shapes.Y0), numel(shapes.Y1)), numel(shapes.Y2)), numel(shapes.Y3))",
233
+ "workgroupSize": "tunables.WORKGROUP_SIZE"
234
+ }
235
+ }
236
+ ]
237
+ },
238
+ {
239
+ "id": "six_outputs",
240
+ "priority": 40,
241
+ "when": ["sixOutputContract"],
242
+ "passes": [
243
+ {
244
+ "id": "main",
245
+ "name": "SplitToSequence6",
246
+ "source": {
247
+ "shader": "split-to-sequence.wgsl.jinja",
248
+ "inputs": {
249
+ "inputShape": "shapes.input",
250
+ "rank": "ranks.input",
251
+ "axis": "attrs.axis if attrs.axis >= 0 else attrs.axis + ranks.input",
252
+ "squeeze": "ranks.Y0 < ranks.input",
253
+ "numOutputs": "6",
254
+ "outShapes": ["shapes.Y0", "shapes.Y1", "shapes.Y2", "shapes.Y3", "shapes.Y4", "shapes.Y5"]
255
+ }
256
+ },
257
+ "bindings": [
258
+ {
259
+ "name": "input",
260
+ "arg": "input",
261
+ "semantic": "input",
262
+ "buffer": { "type": "read-only-storage" },
263
+ "elementType": "$scalar"
264
+ },
265
+ { "name": "y0", "arg": "y0", "semantic": "Y0", "buffer": { "type": "storage" }, "elementType": "$scalar" },
266
+ { "name": "y1", "arg": "y1", "semantic": "Y1", "buffer": { "type": "storage" }, "elementType": "$scalar" },
267
+ { "name": "y2", "arg": "y2", "semantic": "Y2", "buffer": { "type": "storage" }, "elementType": "$scalar" },
268
+ { "name": "y3", "arg": "y3", "semantic": "Y3", "buffer": { "type": "storage" }, "elementType": "$scalar" },
269
+ { "name": "y4", "arg": "y4", "semantic": "Y4", "buffer": { "type": "storage" }, "elementType": "$scalar" },
270
+ { "name": "y5", "arg": "y5", "semantic": "Y5", "buffer": { "type": "storage" }, "elementType": "$scalar" },
271
+ {
272
+ "name": "params",
273
+ "semantic": "kernel.params",
274
+ "buffer": { "type": "uniform" },
275
+ "struct": {
276
+ "name": "Params",
277
+ "fields": [
278
+ { "name": "y0Count", "type": "u32", "value": "numel(shapes.Y0)" },
279
+ { "name": "y1Count", "type": "u32", "value": "numel(shapes.Y1)" },
280
+ { "name": "y2Count", "type": "u32", "value": "numel(shapes.Y2)" },
281
+ { "name": "y3Count", "type": "u32", "value": "numel(shapes.Y3)" },
282
+ { "name": "y4Count", "type": "u32", "value": "numel(shapes.Y4)" },
283
+ { "name": "y5Count", "type": "u32", "value": "numel(shapes.Y5)" }
284
+ ]
285
+ }
286
+ }
287
+ ],
288
+ "dispatch": {
289
+ "threads": "max(max(max(max(max(numel(shapes.Y0), numel(shapes.Y1)), numel(shapes.Y2)), numel(shapes.Y3)), numel(shapes.Y4)), numel(shapes.Y5))",
290
+ "workgroupSize": "tunables.WORKGROUP_SIZE"
291
+ }
292
+ }
293
+ ]
294
+ }
295
+ ]
296
+ }
build/webgpu/metadata.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "ai.onnx.SplitToSequence",
3
+ "id": "_ai_onnx_splittosequence_webgpu_e21e7a0",
4
+ "version": 1,
5
+ "license": "Apache-2.0",
6
+ "backend": { "type": "webgpu" },
7
+ "digest": {
8
+ "algorithm": "sha256",
9
+ "files": {
10
+ "bench.json": "EENkbgxvL5j8em9SHo+NktW1UwzMESrX+8p/FKNCoQc=",
11
+ "manifest.json": "bKxHYk9Csq9b7FX6sH6WaiOZyBawG9Om33PdtCe3kKs=",
12
+ "split-to-sequence.wgsl.jinja": "LTXzbRgOGFK2BVTVM42WPJ9DWr+mx8PcoY9jqf4KBUc=",
13
+ "test.json": "r6D3suRTZe+ljNzJvTQu6Le3qDRRZ6RR68+ObgTAIMY="
14
+ }
15
+ },
16
+ "provenance": { "kernel": { "sha": "2e7068faf55e7f43df740015f6d1ee49391a41c5", "dirty": false } },
17
+ "webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.SplitToSequence" }
18
+ }
build/webgpu/split-to-sequence.wgsl.jinja ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% if usesF16 %}
2
+ enable f16;
3
+ {% endif %}
4
+ {{ env.wgsl.resourceDeclarations }}
5
+
6
+ // SplitToSequence moves contiguous slices along the split axis; the output
7
+ // tensors form the sequence. For size-one slices with
8
+ // keepdims=0, each output drops the axis dimension. The copy reconstructs the
9
+ // full input coordinate by reinserting that axis position.
10
+ {% set R = source.rank %}
11
+ {% set ax = source.axis %}
12
+ {% set acc = namespace(offset=0) %}
13
+ {% for k in range(source.numOutputs) %}
14
+ {% set oShape = source.outShapes[k] %}
15
+ fn input_offset_y{{ k }}(out_index: u32) -> u32 {
16
+ var rem = out_index;
17
+ var offset = 0u;
18
+ {% if source.squeeze %}
19
+ {% for d in range(R - 1) %}
20
+ {% set out_stride = namespace(value=1) %}
21
+ {% for j in range(d + 1, R - 1) %}{% set out_stride.value = out_stride.value * oShape[j] %}{% endfor %}
22
+ {% set in_dim = d if d < ax else d + 1 %}
23
+ {% set in_stride = namespace(value=1) %}
24
+ {% for j in range(in_dim + 1, R) %}{% set in_stride.value = in_stride.value * source.inputShape[j] %}{% endfor %}
25
+ let c{{ d }} = rem / {{ out_stride.value if out_stride.value > 0 else 1 }}u;
26
+ rem = rem % {{ out_stride.value if out_stride.value > 0 else 1 }}u;
27
+ offset = offset + c{{ d }} * {{ in_stride.value }}u;
28
+ {% endfor %}
29
+ {% set axis_stride = namespace(value=1) %}
30
+ {% for j in range(ax + 1, R) %}{% set axis_stride.value = axis_stride.value * source.inputShape[j] %}{% endfor %}
31
+ offset = offset + {{ acc.offset }}u * {{ axis_stride.value }}u;
32
+ {% set acc.offset = acc.offset + 1 %}
33
+ {% else %}
34
+ {% for d in range(R) %}
35
+ {% set out_stride = namespace(value=1) %}
36
+ {% for j in range(d + 1, R) %}{% set out_stride.value = out_stride.value * oShape[j] %}{% endfor %}
37
+ {% set in_stride = namespace(value=1) %}
38
+ {% for j in range(d + 1, R) %}{% set in_stride.value = in_stride.value * source.inputShape[j] %}{% endfor %}
39
+ var c{{ d }} = rem / {{ out_stride.value if out_stride.value > 0 else 1 }}u;
40
+ rem = rem % {{ out_stride.value if out_stride.value > 0 else 1 }}u;
41
+ {% if d == ax %}
42
+ c{{ d }} = c{{ d }} + {{ acc.offset }}u;
43
+ {% endif %}
44
+ offset = offset + c{{ d }} * {{ in_stride.value }}u;
45
+ {% endfor %}
46
+ {% set acc.offset = acc.offset + oShape[ax] %}
47
+ {% endif %}
48
+ return offset;
49
+ }
50
+ {% endfor %}
51
+
52
+ @compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})
53
+ fn main(@builtin(global_invocation_id) gid: vec3<u32>, @builtin(num_workgroups) nwg: vec3<u32>) {
54
+ // 2D-folded flat index: gid.y carries the high bits past the
55
+ // maxComputeWorkgroupsPerDimension dispatch limit (outputs > 16.7M elements).
56
+ let i = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
57
+ {% for k in range(source.numOutputs) %}
58
+ if (i < params.y{{ k }}Count) {
59
+ y{{ k }}[i] = input[input_offset_y{{ k }}(i)];
60
+ }
61
+ {% endfor %}
62
+ }
build/webgpu/test.json ADDED
@@ -0,0 +1,642 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "op": "ai.onnx.SplitToSequence",
3
+ "fixtureArrays": {
4
+ "ort_positive_axis_scalar_split_rank3_input_input": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
5
+ "onnx_backend_split_scalar_axis1_three_outputs_input_input": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
6
+ },
7
+ "cases": [
8
+ {
9
+ "name": "dispatch_cliff_two_outputs_axis0_f32",
10
+ "attrs": { "axis": 0, "keepdims": 1 },
11
+ "inputs": {
12
+ "input": {
13
+ "dtype": "float32",
14
+ "shape": [16777217, 1],
15
+ "data": { "kind": "linspace", "start": 0.0, "end": 1.0 }
16
+ },
17
+ "split": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [16777216, 1] } }
18
+ },
19
+ "outputs": {
20
+ "y0": { "dtype": "float32", "shape": [16777216, 1], "tolerance": 0 },
21
+ "y1": { "dtype": "float32", "shape": [1, 1], "tolerance": 0 }
22
+ }
23
+ },
24
+ {
25
+ "name": "split_1d_three_chunks_f32",
26
+ "attrs": { "axis": 0 },
27
+ "inputs": {
28
+ "input": {
29
+ "dtype": "float32",
30
+ "shape": [6, 2],
31
+ "data": { "kind": "fillFloat32", "sinStep": 0.21, "cosStep": 0.37 }
32
+ },
33
+ "split": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [2, 2, 2] } }
34
+ },
35
+ "outputs": {
36
+ "y0": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
37
+ "y1": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
38
+ "y2": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 }
39
+ }
40
+ },
41
+ {
42
+ "name": "split_1d_unequal_two_chunks_f32",
43
+ "attrs": { "axis": 0 },
44
+ "inputs": {
45
+ "input": {
46
+ "dtype": "float32",
47
+ "shape": [5, 3],
48
+ "data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.29 }
49
+ },
50
+ "split": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 3] } }
51
+ },
52
+ "outputs": {
53
+ "y0": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000001 },
54
+ "y1": { "dtype": "float32", "shape": [3, 3], "tolerance": 0.000001 }
55
+ }
56
+ },
57
+ {
58
+ "name": "scalar_split_two_chunks_f32",
59
+ "attrs": { "axis": 0 },
60
+ "inputs": {
61
+ "input": {
62
+ "dtype": "float32",
63
+ "shape": [4, 2],
64
+ "data": { "kind": "fillFloat32", "sinStep": 0.33, "cosStep": 0.17 }
65
+ },
66
+ "split": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [3] } }
67
+ },
68
+ "outputs": {
69
+ "y0": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
70
+ "y1": { "dtype": "float32", "shape": [1, 2], "tolerance": 0.000001 }
71
+ }
72
+ },
73
+ {
74
+ "name": "no_split_keepdims1_three_f32",
75
+ "attrs": { "axis": 0, "keepdims": 1 },
76
+ "inputs": {
77
+ "input": {
78
+ "dtype": "float32",
79
+ "shape": [3, 2],
80
+ "data": { "kind": "fillFloat32", "sinStep": 0.41, "cosStep": 0.23 }
81
+ }
82
+ },
83
+ "outputs": {
84
+ "y0": { "dtype": "float32", "shape": [1, 2], "tolerance": 0.000001 },
85
+ "y1": { "dtype": "float32", "shape": [1, 2], "tolerance": 0.000001 },
86
+ "y2": { "dtype": "float32", "shape": [1, 2], "tolerance": 0.000001 }
87
+ }
88
+ },
89
+ {
90
+ "name": "no_split_keepdims0_three_f32",
91
+ "attrs": { "axis": 0, "keepdims": 0 },
92
+ "inputs": {
93
+ "input": {
94
+ "dtype": "float32",
95
+ "shape": [3, 2],
96
+ "data": { "kind": "fillFloat32", "sinStep": 0.41, "cosStep": 0.23 }
97
+ }
98
+ },
99
+ "outputs": {
100
+ "y0": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
101
+ "y1": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
102
+ "y2": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 }
103
+ }
104
+ },
105
+ {
106
+ "name": "axis1_two_chunks_f32",
107
+ "attrs": { "axis": 1 },
108
+ "inputs": {
109
+ "input": {
110
+ "dtype": "float32",
111
+ "shape": [2, 4],
112
+ "data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.31 }
113
+ },
114
+ "split": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 2] } }
115
+ },
116
+ "outputs": {
117
+ "y0": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
118
+ "y1": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 }
119
+ }
120
+ },
121
+ {
122
+ "name": "split_1d_three_chunks_f16",
123
+ "attrs": { "axis": 0 },
124
+ "inputs": {
125
+ "input": {
126
+ "dtype": "float16",
127
+ "shape": [6, 2],
128
+ "data": { "kind": "fillFloat32", "sinStep": 0.21, "cosStep": 0.37 }
129
+ },
130
+ "split": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [2, 2, 2] } }
131
+ },
132
+ "outputs": {
133
+ "y0": { "dtype": "float16", "shape": [2, 2], "tolerance": 0.002 },
134
+ "y1": { "dtype": "float16", "shape": [2, 2], "tolerance": 0.002 },
135
+ "y2": { "dtype": "float16", "shape": [2, 2], "tolerance": 0.002 }
136
+ }
137
+ },
138
+ {
139
+ "name": "ort_default_axis0_equal_split_float",
140
+ "provenance": {
141
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
142
+ "test": "SequenceOpsTest.SplitToSequence_DefaultAxis0EqualSplitFloat"
143
+ },
144
+ "inputs": {
145
+ "input": {
146
+ "dtype": "float32",
147
+ "shape": [4, 2],
148
+ "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] }
149
+ },
150
+ "split": { "dtype": "uint32", "shape": [1, 2], "data": { "kind": "values", "values": [2, 2] } }
151
+ },
152
+ "outputs": {
153
+ "y0": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
154
+ "y1": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 }
155
+ }
156
+ },
157
+ {
158
+ "name": "ort_default_axis0_equal_split_float16",
159
+ "provenance": {
160
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
161
+ "test": "SequenceOpsTest.SplitToSequence_DefaultAxis0EqualSplitMLFloat16"
162
+ },
163
+ "inputs": {
164
+ "input": {
165
+ "dtype": "float16",
166
+ "shape": [4, 2],
167
+ "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] }
168
+ },
169
+ "split": { "dtype": "uint32", "shape": [1, 2], "data": { "kind": "values", "values": [2, 2] } }
170
+ },
171
+ "outputs": {
172
+ "y0": { "dtype": "float16", "shape": [2, 2], "tolerance": 0.002 },
173
+ "y1": { "dtype": "float16", "shape": [2, 2], "tolerance": 0.002 }
174
+ }
175
+ },
176
+ {
177
+ "name": "ort_default_axis0_scalar_split_float",
178
+ "provenance": {
179
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
180
+ "test": "SequenceOpsTest.SplitToSequence_DefaultAxis0EqualSplitFloatScalarSplit"
181
+ },
182
+ "inputs": {
183
+ "input": {
184
+ "dtype": "float32",
185
+ "shape": [4, 2],
186
+ "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] }
187
+ },
188
+ "split": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [2] } }
189
+ },
190
+ "outputs": {
191
+ "y0": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
192
+ "y1": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 }
193
+ }
194
+ },
195
+ {
196
+ "name": "ort_default_axis0_uneven_scalar_split_float",
197
+ "provenance": {
198
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
199
+ "test": "SequenceOpsTest.SplitToSequence_DefaultAxis0UnevenSplitFloat"
200
+ },
201
+ "inputs": {
202
+ "input": {
203
+ "dtype": "float32",
204
+ "shape": [5, 2],
205
+ "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0] }
206
+ },
207
+ "split": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [2] } }
208
+ },
209
+ "outputs": {
210
+ "y0": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
211
+ "y1": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
212
+ "y2": { "dtype": "float32", "shape": [1, 2], "tolerance": 0.000001 }
213
+ }
214
+ },
215
+ {
216
+ "name": "ort_positive_axis_scalar_split_rank3",
217
+ "attrs": { "axis": 2 },
218
+ "provenance": {
219
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
220
+ "test": "SequenceOpsTest.SplitToSequence_PositiveAxisScalarSplit"
221
+ },
222
+ "inputs": {
223
+ "input": {
224
+ "dtype": "float32",
225
+ "shape": [2, 2, 6],
226
+ "data": {
227
+ "kind": "values",
228
+ "values": { "$ref": "#/fixtureArrays/ort_positive_axis_scalar_split_rank3_input_input" }
229
+ }
230
+ },
231
+ "split": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [2] } }
232
+ },
233
+ "outputs": {
234
+ "y0": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0.000001 },
235
+ "y1": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0.000001 },
236
+ "y2": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0.000001 }
237
+ }
238
+ },
239
+ {
240
+ "name": "ort_positive_axis_uneven_scalar_split",
241
+ "attrs": { "axis": 1 },
242
+ "provenance": {
243
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
244
+ "test": "SequenceOpsTest.SplitToSequence_PositiveAxisUnevenSplit"
245
+ },
246
+ "inputs": {
247
+ "input": {
248
+ "dtype": "float32",
249
+ "shape": [2, 5],
250
+ "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0] }
251
+ },
252
+ "split": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [2] } }
253
+ },
254
+ "outputs": {
255
+ "y0": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
256
+ "y1": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 },
257
+ "y2": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 }
258
+ }
259
+ },
260
+ {
261
+ "name": "ort_axis0_keepdims0_rank3",
262
+ "attrs": { "axis": 0, "keepdims": 0 },
263
+ "provenance": {
264
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
265
+ "test": "SequenceOpsTest.SplitToSequence_Axis0DefaultSplitFloatSetAxisExplicitlyDontKeepDims3Dim"
266
+ },
267
+ "inputs": {
268
+ "input": {
269
+ "dtype": "float32",
270
+ "shape": [2, 3, 4],
271
+ "data": {
272
+ "kind": "values",
273
+ "values": { "$ref": "#/fixtureArrays/ort_positive_axis_scalar_split_rank3_input_input" }
274
+ }
275
+ }
276
+ },
277
+ "outputs": {
278
+ "y0": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.000001 },
279
+ "y1": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.000001 }
280
+ }
281
+ },
282
+ {
283
+ "name": "ort_axis0_keepdims0_rank2",
284
+ "attrs": { "axis": 0, "keepdims": 0 },
285
+ "provenance": {
286
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
287
+ "test": "SequenceOpsTest.SplitToSequence_Axis0DefaultSplitFloatSetAxisExplicitlyDontKeepDims2Dim"
288
+ },
289
+ "inputs": {
290
+ "input": {
291
+ "dtype": "float32",
292
+ "shape": [2, 3],
293
+ "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
294
+ }
295
+ },
296
+ "outputs": {
297
+ "y0": { "dtype": "float32", "shape": [3], "tolerance": 0.000001 },
298
+ "y1": { "dtype": "float32", "shape": [3], "tolerance": 0.000001 }
299
+ }
300
+ },
301
+ {
302
+ "name": "ort_default_axis0_four_outputs",
303
+ "provenance": {
304
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
305
+ "test": "SequenceOpsTest.SplitToSequence_Axis0DefaultSplitFloatSetAxisExplicitly",
306
+ "notes": "Valid ONNX sequence output modelled as four fixed tensors."
307
+ },
308
+ "attrs": { "axis": 0 },
309
+ "inputs": {
310
+ "input": {
311
+ "dtype": "float32",
312
+ "shape": [4, 2],
313
+ "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] }
314
+ }
315
+ },
316
+ "outputs": {
317
+ "y0": {
318
+ "dtype": "float32",
319
+ "shape": [1, 2],
320
+ "tolerance": 0.000001,
321
+ "data": { "kind": "values", "values": [1.0, 2.0] }
322
+ },
323
+ "y1": {
324
+ "dtype": "float32",
325
+ "shape": [1, 2],
326
+ "tolerance": 0.000001,
327
+ "data": { "kind": "values", "values": [3.0, 4.0] }
328
+ },
329
+ "y2": {
330
+ "dtype": "float32",
331
+ "shape": [1, 2],
332
+ "tolerance": 0.000001,
333
+ "data": { "kind": "values", "values": [5.0, 6.0] }
334
+ },
335
+ "y3": {
336
+ "dtype": "float32",
337
+ "shape": [1, 2],
338
+ "tolerance": 0.000001,
339
+ "data": { "kind": "values", "values": [7.0, 8.0] }
340
+ }
341
+ }
342
+ },
343
+ {
344
+ "name": "ort_bool_split_axis0_four_outputs",
345
+ "provenance": {
346
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
347
+ "test": "SequenceOpsTest.SplitToSequence_BoolSplit",
348
+ "notes": "Valid ONNX bool sequence output modelled as four fixed tensors."
349
+ },
350
+ "attrs": { "axis": 0 },
351
+ "inputs": {
352
+ "input": { "dtype": "bool", "shape": [4, 2], "data": { "kind": "values", "values": [1, 1, 1, 1, 0, 0, 0, 0] } }
353
+ },
354
+ "outputs": {
355
+ "y0": { "dtype": "bool", "shape": [1, 2], "tolerance": 0, "data": { "kind": "values", "values": [1, 1] } },
356
+ "y1": { "dtype": "bool", "shape": [1, 2], "tolerance": 0, "data": { "kind": "values", "values": [1, 1] } },
357
+ "y2": { "dtype": "bool", "shape": [1, 2], "tolerance": 0, "data": { "kind": "values", "values": [0, 0] } },
358
+ "y3": { "dtype": "bool", "shape": [1, 2], "tolerance": 0, "data": { "kind": "values", "values": [0, 0] } }
359
+ }
360
+ },
361
+ {
362
+ "name": "ort_positive_axis_keepdims0_four_outputs",
363
+ "provenance": {
364
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
365
+ "test": "SequenceOpsTest.SplitToSequence_PositiveAxisDontKeepDims",
366
+ "notes": "Valid ONNX keepdims=0 split along a non-leading axis, modelled as four fixed tensors."
367
+ },
368
+ "attrs": { "axis": 2, "keepdims": 0 },
369
+ "inputs": {
370
+ "input": {
371
+ "dtype": "float32",
372
+ "shape": [2, 3, 4],
373
+ "data": {
374
+ "kind": "values",
375
+ "values": { "$ref": "#/fixtureArrays/ort_positive_axis_scalar_split_rank3_input_input" }
376
+ }
377
+ }
378
+ },
379
+ "outputs": {
380
+ "y0": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000001 },
381
+ "y1": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000001 },
382
+ "y2": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000001 },
383
+ "y3": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000001 }
384
+ }
385
+ },
386
+ {
387
+ "name": "ort_default_axis0_uneven_six_outputs",
388
+ "provenance": {
389
+ "source": "onnxruntime/test/providers/cpu/sequence/sequence_ops_test.cc",
390
+ "test": "SequenceOpsTest.SplitToSequence_DefaultAxis0UnevenSplitFloat2",
391
+ "notes": "Valid ONNX uneven scalar split producing six sequence elements."
392
+ },
393
+ "inputs": {
394
+ "input": {
395
+ "dtype": "float32",
396
+ "shape": [17, 2],
397
+ "data": {
398
+ "kind": "values",
399
+ "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0]
400
+ }
401
+ },
402
+ "split": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [3] } }
403
+ },
404
+ "outputs": {
405
+ "y0": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
406
+ "y1": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
407
+ "y2": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
408
+ "y3": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
409
+ "y4": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
410
+ "y5": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 }
411
+ }
412
+ },
413
+ {
414
+ "name": "onnx_backend_split_scalar_axis1_three_outputs",
415
+ "attrs": { "axis": 1 },
416
+ "provenance": {
417
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_split_to_sequence_1",
418
+ "notes": "Official sequence output is represented as fixed tensor outputs y0/y1/y2; int64 split scalar is stored as uint32."
419
+ },
420
+ "inputs": {
421
+ "input": {
422
+ "dtype": "float32",
423
+ "shape": [3, 6],
424
+ "data": {
425
+ "kind": "values",
426
+ "values": { "$ref": "#/fixtureArrays/onnx_backend_split_scalar_axis1_three_outputs_input_input" }
427
+ }
428
+ },
429
+ "split": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [2] } }
430
+ },
431
+ "outputs": {
432
+ "y0": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
433
+ "y1": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 },
434
+ "y2": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 }
435
+ }
436
+ },
437
+ {
438
+ "name": "onnx_backend_split_vector_axis0_two_outputs",
439
+ "attrs": { "axis": 0 },
440
+ "provenance": {
441
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_split_to_sequence_2",
442
+ "notes": "Official sequence output is represented as fixed tensor outputs y0/y1; int64 split vector is stored as uint32."
443
+ },
444
+ "inputs": {
445
+ "input": {
446
+ "dtype": "float32",
447
+ "shape": [3, 6],
448
+ "data": {
449
+ "kind": "values",
450
+ "values": { "$ref": "#/fixtureArrays/onnx_backend_split_scalar_axis1_three_outputs_input_input" }
451
+ }
452
+ },
453
+ "split": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [1, 2] } }
454
+ },
455
+ "outputs": {
456
+ "y0": { "dtype": "float32", "shape": [1, 6], "tolerance": 0.000001 },
457
+ "y1": { "dtype": "float32", "shape": [2, 6], "tolerance": 0.000001 }
458
+ }
459
+ },
460
+ {
461
+ "name": "empty_zero_dim",
462
+ "attrs": { "axis": 0 },
463
+ "inputs": {
464
+ "input": { "dtype": "float32", "shape": [6, 0], "data": { "kind": "values", "values": [] } },
465
+ "split": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [2, 2, 2] } }
466
+ },
467
+ "outputs": {
468
+ "y0": { "dtype": "float32", "shape": [2, 0], "tolerance": 0 },
469
+ "y1": { "dtype": "float32", "shape": [2, 0], "tolerance": 0 },
470
+ "y2": { "dtype": "float32", "shape": [2, 0], "tolerance": 0 }
471
+ }
472
+ },
473
+ {
474
+ "name": "two_outputs_zero_dim",
475
+ "provenance": {
476
+ "notes": "Two-chunk split of a tensor with a zero-width trailing axis. The two-output kernel floors each chunk stride at one so a zero-width output cannot divide by zero; the existing zero-dim case splits into three chunks, which is a different kernel."
477
+ },
478
+ "attrs": { "axis": 0 },
479
+ "inputs": {
480
+ "input": { "dtype": "float32", "shape": [4, 0], "data": { "kind": "values", "values": [] } },
481
+ "split": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 2] } }
482
+ },
483
+ "outputs": {
484
+ "y0": { "dtype": "float32", "shape": [2, 0], "tolerance": 0 },
485
+ "y1": { "dtype": "float32", "shape": [2, 0], "tolerance": 0 }
486
+ }
487
+ },
488
+ {
489
+ "name": "two_outputs_zero_dim_squeeze",
490
+ "provenance": {
491
+ "notes": "Squeezed twin of the case above: keepdims=0 drops the split axis, which is a separate coordinate walk with its own chunk-stride floor. The zero-width trailing axis makes that floor fire."
492
+ },
493
+ "attrs": { "axis": 0, "keepdims": 0 },
494
+ "inputs": { "input": { "dtype": "float32", "shape": [2, 3, 0], "data": { "kind": "values", "values": [] } } },
495
+ "outputs": {
496
+ "y0": { "dtype": "float32", "shape": [3, 0], "tolerance": 0 },
497
+ "y1": { "dtype": "float32", "shape": [3, 0], "tolerance": 0 }
498
+ }
499
+ },
500
+ {
501
+ "name": "ort_caseB_empty",
502
+ "attrs": { "axis": 0 },
503
+ "inputs": {
504
+ "input": {
505
+ "dtype": "float32",
506
+ "shape": [6, 2],
507
+ "data": {
508
+ "kind": "values",
509
+ "values": [0.15191493928432465, 0.14055313169956207, 0.12134978920221329, 0.10187792778015137, 0.08903708308935165, 0.08793208003044128, 0.1010342463850975, 0.1277448534965515, 0.1644245833158493, 0.20488715171813965, 0.24129025638103485, 0.2653009593486786]
510
+ }
511
+ },
512
+ "split": { "dtype": "uint32", "shape": [0], "data": { "kind": "values", "values": [] } }
513
+ },
514
+ "outputs": {
515
+ "y0": {
516
+ "dtype": "float32",
517
+ "shape": [1, 2],
518
+ "data": { "kind": "values", "values": [0.15191493928432465, 0.14055313169956207] },
519
+ "tolerance": 0.001
520
+ },
521
+ "y1": {
522
+ "dtype": "float32",
523
+ "shape": [1, 2],
524
+ "data": { "kind": "values", "values": [0.12134978920221329, 0.10187792778015137] },
525
+ "tolerance": 0.001
526
+ },
527
+ "y2": {
528
+ "dtype": "float32",
529
+ "shape": [1, 2],
530
+ "data": { "kind": "values", "values": [0.08903708308935165, 0.08793208003044128] },
531
+ "tolerance": 0.001
532
+ }
533
+ }
534
+ },
535
+ {
536
+ "name": "keepdims0_axis2_three_outputs_squeeze_f32",
537
+ "attrs": { "axis": 2, "keepdims": 0 },
538
+ "inputs": {
539
+ "input": {
540
+ "dtype": "float32",
541
+ "shape": [2, 3, 3],
542
+ "data": {
543
+ "kind": "values",
544
+ "values": { "$ref": "#/fixtureArrays/onnx_backend_split_scalar_axis1_three_outputs_input_input" }
545
+ }
546
+ }
547
+ },
548
+ "outputs": {
549
+ "y0": { "dtype": "float32", "shape": [2, 3], "tolerance": 0 },
550
+ "y1": { "dtype": "float32", "shape": [2, 3], "tolerance": 0 },
551
+ "y2": { "dtype": "float32", "shape": [2, 3], "tolerance": 0 }
552
+ }
553
+ },
554
+ {
555
+ "name": "negative_axis_neg1_scalar_split_rank3_f32",
556
+ "attrs": { "axis": -1 },
557
+ "inputs": {
558
+ "input": {
559
+ "dtype": "float32",
560
+ "shape": [2, 2, 6],
561
+ "data": {
562
+ "kind": "values",
563
+ "values": { "$ref": "#/fixtureArrays/ort_positive_axis_scalar_split_rank3_input_input" }
564
+ }
565
+ },
566
+ "split": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [2] } }
567
+ },
568
+ "outputs": {
569
+ "y0": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0 },
570
+ "y1": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0 },
571
+ "y2": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0 }
572
+ }
573
+ },
574
+ {
575
+ "name": "negative_axis_neg2_keepdims0_three_outputs_squeeze_f32",
576
+ "attrs": { "axis": -2, "keepdims": 0 },
577
+ "inputs": {
578
+ "input": {
579
+ "dtype": "float32",
580
+ "shape": [2, 3, 4],
581
+ "data": {
582
+ "kind": "values",
583
+ "values": { "$ref": "#/fixtureArrays/ort_positive_axis_scalar_split_rank3_input_input" }
584
+ }
585
+ }
586
+ },
587
+ "outputs": {
588
+ "y0": { "dtype": "float32", "shape": [2, 4], "tolerance": 0 },
589
+ "y1": { "dtype": "float32", "shape": [2, 4], "tolerance": 0 },
590
+ "y2": { "dtype": "float32", "shape": [2, 4], "tolerance": 0 }
591
+ }
592
+ },
593
+ {
594
+ "name": "rank6_middle_axis_two_outputs_deep_strides_f32",
595
+ "attrs": { "axis": 2 },
596
+ "inputs": {
597
+ "input": {
598
+ "dtype": "float32",
599
+ "shape": [2, 2, 4, 2, 2, 3],
600
+ "data": { "kind": "linspace", "start": 0.0, "end": 1.0 }
601
+ },
602
+ "split": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [3, 1] } }
603
+ },
604
+ "outputs": {
605
+ "y0": { "dtype": "float32", "shape": [2, 2, 3, 2, 2, 3], "tolerance": 0 },
606
+ "y1": { "dtype": "float32", "shape": [2, 2, 1, 2, 2, 3], "tolerance": 0 }
607
+ }
608
+ },
609
+ {
610
+ "name": "rank7_two_outputs",
611
+ "attrs": { "axis": 5, "keepdims": 1 },
612
+ "inputs": {
613
+ "input": {
614
+ "dtype": "float32",
615
+ "shape": [1, 1, 1, 1, 1, 2, 3],
616
+ "data": { "kind": "linspace", "start": 0.0, "end": 5.0 }
617
+ },
618
+ "split": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [1, 1] } }
619
+ },
620
+ "outputs": {
621
+ "y0": { "dtype": "float32", "shape": [1, 1, 1, 1, 1, 1, 3], "tolerance": 0 },
622
+ "y1": { "dtype": "float32", "shape": [1, 1, 1, 1, 1, 1, 3], "tolerance": 0 }
623
+ }
624
+ },
625
+ {
626
+ "name": "rank8_two_outputs",
627
+ "attrs": { "axis": 6, "keepdims": 1 },
628
+ "inputs": {
629
+ "input": {
630
+ "dtype": "float32",
631
+ "shape": [1, 1, 1, 1, 1, 1, 2, 3],
632
+ "data": { "kind": "linspace", "start": 1.0, "end": 6.0 }
633
+ },
634
+ "split": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [1, 1] } }
635
+ },
636
+ "outputs": {
637
+ "y0": { "dtype": "float32", "shape": [1, 1, 1, 1, 1, 1, 1, 3], "tolerance": 0 },
638
+ "y1": { "dtype": "float32", "shape": [1, 1, 1, 1, 1, 1, 1, 3], "tolerance": 0 }
639
+ }
640
+ }
641
+ ]
642
+ }