Xenova HF Staff commited on
Commit
49b0523
·
verified ·
1 Parent(s): 49b3ea5

sync 2e7068faf55e

Browse files
README.md CHANGED
@@ -1,3 +1,77 @@
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.LayerNormalization
10
+
11
+ `ai.onnx` · standard ONNX operator · ONNX opset ≥ 17
12
+
13
+ ## Description
14
+
15
+ Normalizes a tensor along a suffix of axes starting at `axis` by subtracting the mean and dividing by the square root of the variance plus `epsilon`, then scales and optionally shifts the result with learnable `Scale` and `B` tensors. The output `Y` has the same shape as `X`; optional outputs `Mean` and `InvStdDev` expose the per-normalization-group statistics computed during normalization.
16
+
17
+ See the [ONNX `LayerNormalization` spec](https://onnx.ai/onnx/operators/onnx__LayerNormalization.html) for the reference semantics.
18
+
19
+ ## Inputs
20
+
21
+ | Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
22
+ | --- | --- | --- | --- | --- | --- | --- |
23
+ | `X` | `x` | `T` | — | — | Tensor to be normalized. | required |
24
+ | `Scale` | `scale` | `T` | — | — | Scale tensor applied after normalization. | required |
25
+ | `B` | `b` | `T` | — | — | Optional bias tensor added after scaling. | optional |
26
+
27
+ ## Outputs
28
+
29
+ | Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
30
+ | --- | --- | --- | --- | --- | --- | --- |
31
+ | `Y` | `y` | `T` | same as `X` | same as `X` | Normalized and scaled output tensor; same shape as X. | required |
32
+ | `Mean` | `mean` | `float32` | same as `X` | — | Per-normalization-group mean in the ONNX broadcastable keepdims shape: dimensions before `axis` are preserved and dimensions from `axis` onward are 1. | optional |
33
+ | `InvStdDev` | `invStdDev` | `float32` | same as `X` | — | Per-normalization-group reciprocal standard deviation `1 / sqrt(variance + epsilon)`, returned in the same ONNX broadcastable keepdims shape as `Mean`. | optional |
34
+
35
+ ## Attributes
36
+
37
+ Default values (overridable per request):
38
+
39
+ | Attribute | Default | Description |
40
+ | --- | --- | --- |
41
+ | `axis` | `-1` | The first axis of the normalization range; all axes from `axis` to the last are normalized together. Negative values count from the end; the default `-1` normalizes only the last dimension. |
42
+ | `epsilon` | `0.00001` | Small constant added to the variance before taking the square root to avoid division by zero. |
43
+ | `stash_type` | `1` | TensorProto element type used for the normalization stage and optional statistics; the implemented ONNX route supports the standard float32 value (`1`). |
44
+
45
+ ## Type constraints
46
+
47
+ | Variable | Allowed dtypes |
48
+ | --- | --- |
49
+ | `T` | `float32`, `float16` |
50
+
51
+ ## Files
52
+
53
+ - [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, provenance)
54
+ - [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
55
+ - [`test.json`](build/webgpu/test.json) — correctness cases
56
+ - [`bench.json`](build/webgpu/bench.json) — benchmark + tuning cases
57
+ - [`layer-normalization.wgsl.jinja`](build/webgpu/layer-normalization.wgsl.jinja)
58
+ - [`norm-row-stats.wgsl.jinja`](build/webgpu/norm-row-stats.wgsl.jinja)
59
+
60
+ ## Use with `@huggingface/kernels`
61
+
62
+ The loader derives every required output's shape and logical dtype from the manifest contract and this call.
63
+ It then allocates the result tensors automatically.
64
+
65
+ The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
66
+
67
+ Replace each `*Data` placeholder with a typed array containing the corresponding input data.
68
+
69
+ ```js
70
+ import { getKernel } from "@huggingface/kernels";
71
+
72
+ const kernel = await getKernel("webgpu-kernels/ai.onnx.LayerNormalization", { version: 1 });
73
+ const { y } = await kernel({
74
+ x: { data: xData, shape: [1, 4] },
75
+ scale: { data: scaleData, shape: [4] },
76
+ });
77
+ ```
build/webgpu/bench.json ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "op": "ai.onnx.LayerNormalization",
3
+ "cases": [
4
+ {
5
+ "name": "layernorm-f32-256x1024",
6
+ "preset": "smoke",
7
+ "vars": { "dtype": "float32", "rows": 256, "dim": 1024 },
8
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
9
+ "inputs": {
10
+ "x": { "shape": [256, 1024], "dtype": "float32", "dist": "normal", "seed": 720, "scale": 0.5 },
11
+ "scale": { "shape": [1024], "dtype": "float32", "dist": "uniform", "seed": 721, "scale": 0.25, "offset": 1 },
12
+ "b": { "shape": [1024], "dtype": "float32", "dist": "normal", "seed": 722, "scale": 0.1 }
13
+ },
14
+ "outputs": { "y": { "shape": [256, 1024], "dtype": "float32" } },
15
+ "bench": {
16
+ "primary": true,
17
+ "metrics": [
18
+ { "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim * 2) * dtypeBytes(args.dtype)" }
19
+ ]
20
+ }
21
+ },
22
+ {
23
+ "name": "layernorm-f32-4096x4096",
24
+ "preset": "smoke",
25
+ "vars": { "dtype": "float32", "rows": 4096, "dim": 4096 },
26
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
27
+ "inputs": {
28
+ "x": { "shape": [4096, 4096], "dtype": "float32", "dist": "normal", "seed": 730, "scale": 0.5 },
29
+ "scale": { "shape": [4096], "dtype": "float32", "dist": "uniform", "seed": 731, "scale": 0.25, "offset": 1 },
30
+ "b": { "shape": [4096], "dtype": "float32", "dist": "normal", "seed": 732, "scale": 0.1 }
31
+ },
32
+ "outputs": { "y": { "shape": [4096, 4096], "dtype": "float32" } },
33
+ "bench": {
34
+ "primary": true,
35
+ "metrics": [
36
+ { "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim * 2) * dtypeBytes(args.dtype)" }
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "name": "layernorm-f16-4096x4096",
42
+ "preset": "smoke",
43
+ "vars": { "dtype": "float16", "rows": 4096, "dim": 4096 },
44
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
45
+ "inputs": {
46
+ "x": { "shape": [4096, 4096], "dtype": "float16", "dist": "normal", "seed": 733, "scale": 0.5 },
47
+ "scale": { "shape": [4096], "dtype": "float16", "dist": "uniform", "seed": 734, "scale": 0.25, "offset": 1 },
48
+ "b": { "shape": [4096], "dtype": "float16", "dist": "normal", "seed": 735, "scale": 0.1 }
49
+ },
50
+ "outputs": { "y": { "shape": [4096, 4096], "dtype": "float16" } },
51
+ "bench": {
52
+ "metrics": [
53
+ { "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim * 2) * dtypeBytes(args.dtype)" }
54
+ ]
55
+ }
56
+ },
57
+ {
58
+ "name": "layernorm-f32-4096x2050-unaligned-cliff",
59
+ "preset": "smoke",
60
+ "vars": { "dtype": "float32", "rows": 4096, "dim": 2050 },
61
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
62
+ "inputs": {
63
+ "x": { "shape": [4096, 2050], "dtype": "float32", "dist": "normal", "seed": 740, "scale": 0.5 },
64
+ "scale": { "shape": [2050], "dtype": "float32", "dist": "uniform", "seed": 741, "scale": 0.25, "offset": 1 },
65
+ "b": { "shape": [2050], "dtype": "float32", "dist": "normal", "seed": 742, "scale": 0.1 }
66
+ },
67
+ "outputs": { "y": { "shape": [4096, 2050], "dtype": "float32" } },
68
+ "bench": {
69
+ "metrics": [
70
+ { "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim * 2) * dtypeBytes(args.dtype)" }
71
+ ]
72
+ }
73
+ },
74
+ {
75
+ "name": "layernorm-f32-4096x1022-subgroup-nonvec4",
76
+ "preset": "smoke",
77
+ "vars": { "dtype": "float32", "rows": 4096, "dim": 1022 },
78
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
79
+ "inputs": {
80
+ "x": { "shape": [4096, 1022], "dtype": "float32", "dist": "normal", "seed": 743, "scale": 0.5 },
81
+ "scale": { "shape": [1022], "dtype": "float32", "dist": "uniform", "seed": 744, "scale": 0.25, "offset": 1 },
82
+ "b": { "shape": [1022], "dtype": "float32", "dist": "normal", "seed": 745, "scale": 0.1 }
83
+ },
84
+ "outputs": { "y": { "shape": [4096, 1022], "dtype": "float32" } },
85
+ "bench": {
86
+ "metrics": [
87
+ { "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim * 2) * dtypeBytes(args.dtype)" }
88
+ ]
89
+ }
90
+ },
91
+ {
92
+ "name": "layernorm-f16-1x4096-rows1-decode",
93
+ "preset": "smoke",
94
+ "vars": { "dtype": "float16", "rows": 1, "dim": 4096 },
95
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
96
+ "inputs": {
97
+ "x": { "shape": [1, 4096], "dtype": "float16", "dist": "normal", "seed": 746, "scale": 0.5 },
98
+ "scale": { "shape": [4096], "dtype": "float16", "dist": "uniform", "seed": 747, "scale": 0.25, "offset": 1 },
99
+ "b": { "shape": [4096], "dtype": "float16", "dist": "normal", "seed": 748, "scale": 0.1 }
100
+ },
101
+ "outputs": { "y": { "shape": [1, 4096], "dtype": "float16" } },
102
+ "bench": {
103
+ "metrics": [
104
+ { "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim * 2) * dtypeBytes(args.dtype)" }
105
+ ]
106
+ }
107
+ },
108
+ {
109
+ "name": "layernorm-f32-512x4096-suffix-axis1-rank3",
110
+ "preset": "smoke",
111
+ "vars": { "dtype": "float32", "outer": 512, "hidden": 4096 },
112
+ "attrs": { "epsilon": 0.00001, "axis": 1 },
113
+ "inputs": {
114
+ "x": { "shape": [512, 256, 16], "dtype": "float32", "dist": "normal", "seed": 749, "scale": 0.5 },
115
+ "scale": { "shape": [256, 16], "dtype": "float32", "dist": "uniform", "seed": 750, "scale": 0.25, "offset": 1 },
116
+ "b": { "shape": [256, 16], "dtype": "float32", "dist": "normal", "seed": 751, "scale": 0.1 }
117
+ },
118
+ "outputs": { "y": { "shape": [512, 256, 16], "dtype": "float32" } },
119
+ "bench": {
120
+ "metrics": [
121
+ { "type": "bandwidth", "value": "(args.outer * args.hidden * 2 + args.hidden * 2) * dtypeBytes(args.dtype)" }
122
+ ]
123
+ }
124
+ },
125
+ {
126
+ "name": "layernorm-f32-8192x4096-broadcast-scale-generic-fallback",
127
+ "preset": "stress",
128
+ "vars": { "dtype": "float32", "rows": 8192, "dim": 4096 },
129
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
130
+ "inputs": {
131
+ "x": { "shape": [8192, 4096], "dtype": "float32", "dist": "normal", "seed": 760, "scale": 0.5 },
132
+ "scale": {
133
+ "shape": [8192, 4096],
134
+ "dtype": "float32",
135
+ "dist": "uniform",
136
+ "seed": 761,
137
+ "scale": 0.25,
138
+ "offset": 1
139
+ }
140
+ },
141
+ "outputs": { "y": { "shape": [8192, 4096], "dtype": "float32", "dist": "empty" } },
142
+ "bench": {
143
+ "primary": true,
144
+ "metrics": [
145
+ { "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.rows * args.dim) * dtypeBytes(args.dtype)" }
146
+ ]
147
+ }
148
+ },
149
+ {
150
+ "name": "layernorm-f32-65536x64-broadcast-scale-narrow-hidden-launchbound",
151
+ "preset": "stress",
152
+ "vars": { "dtype": "float32", "rows": 65536, "dim": 64 },
153
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
154
+ "inputs": {
155
+ "x": { "shape": [65536, 64], "dtype": "float32", "dist": "normal", "seed": 762, "scale": 0.5 },
156
+ "scale": {
157
+ "shape": [65536, 64],
158
+ "dtype": "float32",
159
+ "dist": "uniform",
160
+ "seed": 763,
161
+ "scale": 0.25,
162
+ "offset": 1
163
+ }
164
+ },
165
+ "outputs": { "y": { "shape": [65536, 64], "dtype": "float32", "dist": "empty" } },
166
+ "bench": {
167
+ "metrics": [
168
+ { "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.rows * args.dim) * dtypeBytes(args.dtype)" }
169
+ ]
170
+ }
171
+ },
172
+ {
173
+ "name": "layernorm-f32-4096x4096-broadcast-bias-generic-fallback",
174
+ "preset": "stress",
175
+ "vars": { "dtype": "float32", "rows": 4096, "dim": 4096 },
176
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
177
+ "inputs": {
178
+ "x": { "shape": [4096, 4096], "dtype": "float32", "dist": "normal", "seed": 764, "scale": 0.5 },
179
+ "scale": {
180
+ "shape": [4096, 4096],
181
+ "dtype": "float32",
182
+ "dist": "uniform",
183
+ "seed": 765,
184
+ "scale": 0.25,
185
+ "offset": 1
186
+ },
187
+ "b": { "shape": [4096, 4096], "dtype": "float32", "dist": "normal", "seed": 766, "scale": 0.1 }
188
+ },
189
+ "outputs": { "y": { "shape": [4096, 4096], "dtype": "float32", "dist": "empty" } },
190
+ "bench": {
191
+ "metrics": [
192
+ {
193
+ "type": "bandwidth",
194
+ "value": "(args.rows * args.dim * 2 + args.rows * args.dim * 2) * dtypeBytes(args.dtype)"
195
+ }
196
+ ]
197
+ }
198
+ }
199
+ ]
200
+ }
build/webgpu/layer-normalization.wgsl.jinja ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% if usesF16 %}
2
+ enable f16;
3
+ {% endif %}
4
+ {% macro offset_fn(fn_name, opShape, opRank, op_same, op_numel, outShape, outRank, out_numel) %}
5
+ fn {{ fn_name }}({% if out_numel != 0 and op_numel != 1 %}out_index: u32{% endif %}) -> u32 {
6
+ {% if out_numel == 0 %}
7
+ return 0u;
8
+ {% elif op_numel == 1 %}
9
+ return 0u;
10
+ {% elif op_same %}
11
+ return out_index;
12
+ {% else %}
13
+ var offset = 0u;
14
+ {% for axis in range(outRank) %}
15
+ {% set op_axis = axis - (outRank - opRank) %}
16
+ {% if op_axis >= 0 and opShape[op_axis] != 1 %}
17
+ {% set c_stride = namespace(value=1) %}
18
+ {% for j in range(axis + 1, outRank) %}
19
+ {% set c_stride.value = c_stride.value * outShape[j] %}
20
+ {% endfor %}
21
+ {% set op_stride = namespace(value=1) %}
22
+ {% for j in range(op_axis + 1, opRank) %}
23
+ {% set op_stride.value = op_stride.value * opShape[j] %}
24
+ {% endfor %}
25
+ {% if c_stride.value == 1 %}
26
+ let coord{{ axis }} = out_index % {{ outShape[axis] }}u;
27
+ {% else %}
28
+ let coord{{ axis }} = (out_index / {{ c_stride.value }}u) % {{ outShape[axis] }}u;
29
+ {% endif %}
30
+ {% if op_stride.value == 1 %}
31
+ offset = offset + coord{{ axis }};
32
+ {% else %}
33
+ offset = offset + coord{{ axis }} * {{ op_stride.value }}u;
34
+ {% endif %}
35
+ {% endif %}
36
+ {% endfor %}
37
+ return offset;
38
+ {% endif %}
39
+ }
40
+ {%- endmacro %}{% macro broadcast_offset_call(fn_name, opShape, outShape, out_index) %}
41
+ {% set op_numel = namespace(value=1) %}
42
+ {% for d in opShape %}{% set op_numel.value = op_numel.value * d %}{% endfor %}
43
+ {% set out_numel = namespace(value=1) %}
44
+ {% for d in outShape %}{% set out_numel.value = out_numel.value * d %}{% endfor %}
45
+ {{ fn_name }}({% if out_numel.value != 0 and op_numel.value != 1 %}{{ out_index }}{% endif %})
46
+ {%- endmacro %}
47
+
48
+ {{ env.wgsl.resourceDeclarations }}
49
+
50
+ const HIDDEN: u32 = {{ hiddenSize }}u;
51
+ const EPSILON: f32 = {{ epsilon }};
52
+ const WG: u32 = {{ workgroupSize }}u;
53
+
54
+ var<workgroup> partial: array<f32, WG>;
55
+ var<workgroup> row_mean: f32;
56
+ var<workgroup> row_inv: f32;
57
+
58
+ {% set xNumel = namespace(value=1) %}
59
+ {% for dim in source.xShape %}
60
+ {% set xNumel.value = xNumel.value * dim %}
61
+ {% endfor %}
62
+ {% set scaleNumel = namespace(value=1) %}
63
+ {% for dim in source.scaleShape %}
64
+ {% set scaleNumel.value = scaleNumel.value * dim %}
65
+ {% endfor %}
66
+ {% if scaleNumel.value != 1 %}
67
+ {{ offset_fn("scale_offset", source.scaleShape, source.scaleShape | length, source.scaleShape == source.xShape, scaleNumel.value, source.xShape, source.xShape | length, xNumel.value) }}
68
+ {% endif %}
69
+
70
+ {% if hasBias %}
71
+ {% set biasNumel = namespace(value=1) %}
72
+ {% for dim in source.biasShape %}
73
+ {% set biasNumel.value = biasNumel.value * dim %}
74
+ {% endfor %}
75
+ {% if biasNumel.value != 1 %}
76
+ {{ offset_fn("bias_offset", source.biasShape, source.biasShape | length, source.biasShape == source.xShape, biasNumel.value, source.xShape, source.xShape | length, xNumel.value) }}
77
+ {% endif %}
78
+
79
+ {% endif %}
80
+ {% macro wgsl_tree_fold_stmt(a, op, idx, svar) %}
81
+ {% if op == "max" %}
82
+ {{ a }}[{{ idx }}] = max({{ a }}[{{ idx }}], {{ a }}[{{ idx }} + {{ svar }}]);
83
+ {%- else %}
84
+ {{ a }}[{{ idx }}] = {{ a }}[{{ idx }}] + {{ a }}[{{ idx }} + {{ svar }}];
85
+ {%- endif %}
86
+ {% endmacro %}
87
+ {% macro wgsl_tree_fold(arrays, op="add", idx="lid", wg="WORKGROUP_SIZE", svar="stride", typed=false, form="tail", breakInline=false, bodyInline=false, barrierFirst=false) %}
88
+ var {{ svar }}{{ ": u32 " if typed else " " }}= {{ wg }} / 2u;
89
+ loop {
90
+ {% if form == "head" %}
91
+ {% if breakInline %}
92
+ if ({{ svar }} == 0u) { break; }
93
+ {% else %}
94
+ if ({{ svar }} == 0u) {
95
+ break;
96
+ }
97
+ {% endif %}
98
+ {% endif %}
99
+ {% if bodyInline %}
100
+ if ({{ idx }} < {{ svar }}) { {{ wgsl_tree_fold_stmt(arrays[0], op, idx, svar) }} }
101
+ {% else %}
102
+ if ({{ idx }} < {{ svar }}) {
103
+ {% for a in arrays %}
104
+ {{ wgsl_tree_fold_stmt(a, op, idx, svar) }}
105
+ {% endfor %}
106
+ }
107
+ {% endif %}
108
+ {% if form == "head" %}
109
+ {% if barrierFirst %}
110
+ workgroupBarrier();
111
+ {{ svar }} = {{ svar }} / 2u;
112
+ {% else %}
113
+ {{ svar }} = {{ svar }} / 2u;
114
+ workgroupBarrier();
115
+ {% endif %}
116
+ {% else %}
117
+ workgroupBarrier();
118
+ if ({{ svar }} == 1u) {
119
+ break;
120
+ }
121
+ {{ svar }} = {{ svar }} / 2u;
122
+ {% endif %}
123
+ }
124
+ {%- endmacro %}
125
+
126
+ // Reusing partial after this reduction requires a barrier between the read of
127
+ // partial[0] and the next write, or the next round can race the prior readers.
128
+ {% set trailingBarrier = trailingBarrier is defined and trailingBarrier %}
129
+ fn reduce_sum(value: f32, tid: u32) -> f32 {
130
+ partial[tid] = value;
131
+ workgroupBarrier();
132
+ {{ wgsl_tree_fold(["partial"], idx="tid", wg="WG", form="head") }}
133
+ {% if trailingBarrier %}
134
+ let total = partial[0];
135
+ workgroupBarrier();
136
+ return total;
137
+ {% else %}
138
+ return partial[0];
139
+ {% endif %}
140
+ }
141
+
142
+
143
+ @compute @workgroup_size(WG, 1, 1)
144
+ fn main(@builtin(workgroup_id) wg: vec3<u32>, @builtin(local_invocation_id) lid: vec3<u32>) {
145
+ let row = wg.x + wg.y * params.rowStride;
146
+ if (row >= params.rows) {
147
+ return;
148
+ }
149
+ let tid = lid.x;
150
+ let base = row * HIDDEN;
151
+
152
+ var local_sum = 0.0;
153
+ for (var d = tid; d < HIDDEN; d = d + WG) {
154
+ let value = f32(x[base + d]);
155
+ local_sum = local_sum + value;
156
+ }
157
+
158
+ let sum = reduce_sum(local_sum, tid);
159
+ if (tid == 0u) {
160
+ row_mean = sum / f32(HIDDEN);
161
+ }
162
+ workgroupBarrier();
163
+
164
+ var local_var_sum = 0.0;
165
+ for (var d = tid; d < HIDDEN; d = d + WG) {
166
+ let diff = f32(x[base + d]) - row_mean;
167
+ local_var_sum = local_var_sum + diff * diff;
168
+ }
169
+
170
+ let var_sum = reduce_sum(local_var_sum, tid);
171
+ if (tid == 0u) {
172
+ let variance = var_sum / f32(HIDDEN);
173
+ row_inv = inverseSqrt(variance + EPSILON);
174
+ {% if writeMean %}
175
+ mean_out[row] = row_mean;
176
+ {% endif %}
177
+ {% if writeInvStdDev %}
178
+ inv_std_out[row] = row_inv;
179
+ {% endif %}
180
+ }
181
+ workgroupBarrier();
182
+
183
+ for (var d = tid; d < HIDDEN; d = d + WG) {
184
+ let index = base + d;
185
+ let normalized = (f32(x[index]) - row_mean) * row_inv;
186
+ var value = normalized * f32(scale[{% if scaleNumel.value == 1 %}0u{% else %}{{ broadcast_offset_call("scale_offset", source.scaleShape, source.xShape, "index") }}{% endif %}]);
187
+ {% if hasBias %}
188
+ value = value + f32(bias[{% if biasNumel.value == 1 %}0u{% else %}{{ broadcast_offset_call("bias_offset", source.biasShape, source.xShape, "index") }}{% endif %}]);
189
+ {% endif %}
190
+ y[index] = {{ scalar }}(value);
191
+ }
192
+ }
build/webgpu/manifest.json ADDED
@@ -0,0 +1,975 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "domain": "ai.onnx",
3
+ "name": "LayerNormalization",
4
+ "sinceVersion": 17,
5
+ "description": "Normalizes a tensor along a suffix of axes starting at `axis` by subtracting the mean and dividing by the square root of the variance plus `epsilon`, then scales and optionally shifts the result with learnable `Scale` and `B` tensors. The output `Y` has the same shape as `X`; optional outputs `Mean` and `InvStdDev` expose the per-normalization-group statistics computed during normalization.",
6
+ "inputs": [
7
+ { "role": "X", "dtype": "T", "description": "Tensor to be normalized." },
8
+ { "role": "Scale", "dtype": "T", "description": "Scale tensor applied after normalization." },
9
+ { "role": "B", "dtype": "T", "optional": true, "description": "Optional bias tensor added after scaling." }
10
+ ],
11
+ "outputs": [
12
+ {
13
+ "role": "Y",
14
+ "dtype": "T",
15
+ "rank": "ranks.X",
16
+ "description": "Normalized and scaled output tensor; same shape as X.",
17
+ "shape": "shapes.X"
18
+ },
19
+ {
20
+ "role": "Mean",
21
+ "dtype": "float32",
22
+ "optional": true,
23
+ "description": "Per-normalization-group mean in the ONNX broadcastable keepdims shape: dimensions before `axis` are preserved and dimensions from `axis` onward are 1.",
24
+ "rank": "ranks.X"
25
+ },
26
+ {
27
+ "role": "InvStdDev",
28
+ "dtype": "float32",
29
+ "optional": true,
30
+ "description": "Per-normalization-group reciprocal standard deviation `1 / sqrt(variance + epsilon)`, returned in the same ONNX broadcastable keepdims shape as `Mean`.",
31
+ "rank": "ranks.X"
32
+ }
33
+ ],
34
+ "attributes": { "axis": -1, "epsilon": 0.00001, "stash_type": 1 },
35
+ "attributeDescriptions": {
36
+ "axis": "The first axis of the normalization range; all axes from `axis` to the last are normalized together. Negative values count from the end; the default `-1` normalizes only the last dimension.",
37
+ "epsilon": "Small constant added to the variance before taking the square root to avoid division by zero.",
38
+ "stash_type": "TensorProto element type used for the normalization stage and optional statistics; the implemented ONNX route supports the standard float32 value (`1`)."
39
+ },
40
+ "attributeConstraints": { "stash_type": { "values": [1] } },
41
+ "typeConstraints": { "T": ["float32", "float16"] },
42
+ "args": {
43
+ "x": { "kind": "tensor", "semantic": "X", "role": "input" },
44
+ "scale": { "kind": "tensor", "semantic": "Scale", "role": "input" },
45
+ "b": { "kind": "tensor", "semantic": "B", "role": "input", "required": false },
46
+ "y": { "kind": "tensor", "semantic": "Y", "role": "output" },
47
+ "mean": { "kind": "tensor", "semantic": "Mean", "role": "output", "required": false },
48
+ "invStdDev": { "kind": "tensor", "semantic": "InvStdDev", "role": "output", "required": false }
49
+ },
50
+ "tunables": { "MAX_WORKGROUP_SIZE": 256, "SCALAR_FAST_MAX_HIDDEN": 1024 },
51
+ "derive": {
52
+ "deviceWorkgroupCap": "min(device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX)",
53
+ "normWorkgroupCap": "min(tunables.MAX_WORKGROUP_SIZE, deviceWorkgroupCap)",
54
+ "hasSubgroupId": "device.features.has(\"subgroups\") and device.wgslLanguageFeatures.has(\"subgroup_id\")",
55
+ "lastAxisWg": "min(normWorkgroupCap, pow2ceil(dim(shapes.X, -1)))",
56
+ "lastAxisWgVec4": "min(normWorkgroupCap, pow2ceil(dim(shapes.X, -1) / 4))",
57
+ "lastAxisContractOk": "ranks.X >= 1 and ranks.Y == ranks.X and numel(shapes.X) == numel(shapes.Y) and (attrs.axis == -1 or attrs.axis == ranks.X - 1)",
58
+ "suffixAxisContractOk": "ranks.X >= 2 and ranks.Y == ranks.X and numel(shapes.X) == numel(shapes.Y) and attrs.axis + ranks.X >= 0 and attrs.axis < ranks.X and not (attrs.axis == -1 or attrs.axis == ranks.X - 1)",
59
+ "axisNorm": "attrs.axis if attrs.axis >= 0 else attrs.axis + ranks.X",
60
+ "normRows": "numel(shapes.X) / max(1, dim(shapes.X, -1)) if lastAxisContractOk else outer(shapes.X, axisNorm)",
61
+ "normRowStride": "max(1, min(normRows, device.limits.maxComputeWorkgroupsPerDimension))",
62
+ "suffixAxisSize": "numel(shapes.X) / max(1, outer(shapes.X, axisNorm))",
63
+ "suffixAxisWg": "min(normWorkgroupCap, pow2ceil(suffixAxisSize))",
64
+ "suffixAxisWgVec4": "min(normWorkgroupCap, pow2ceil(suffixAxisSize / 4))",
65
+ "genericHiddenSize": "dim(shapes.X, -1) if lastAxisContractOk else suffixAxisSize",
66
+ "genericWorkgroupSize": "lastAxisWg if lastAxisContractOk else suffixAxisWg",
67
+ "scaleExactOk": "ranks.X >= 1 and ranks.Scale >= 1 and numel(shapes.Scale) == dim(shapes.X, -1) and dim(shapes.Scale, -1) == dim(shapes.X, -1)",
68
+ "scaleBroadcastOk": "ranks.Scale >= 0 and ranks.Scale <= ranks.X and broadcastable(shapes.Scale, shapes.X)",
69
+ "biasExactOk": "present.b and ranks.X >= 1 and ranks.B >= 1 and numel(shapes.B) == dim(shapes.X, -1) and dim(shapes.B, -1) == dim(shapes.X, -1)",
70
+ "biasBroadcastOk": "present.b and ranks.B >= 0 and ranks.B <= ranks.X and broadcastable(shapes.B, shapes.X)",
71
+ "suffixScaleExactOk": "suffixAxisContractOk and scaleBroadcastOk and numel(shapes.Scale) == suffixAxisSize",
72
+ "suffixBiasExactOk": "present.b and suffixAxisContractOk and biasBroadcastOk and numel(shapes.B) == suffixAxisSize",
73
+ "lastAxisExactScaleOk": "lastAxisContractOk and scaleExactOk",
74
+ "lastAxisBroadcastScaleOk": "lastAxisContractOk and scaleBroadcastOk",
75
+ "suffixAxisBroadcastScaleOk": "suffixAxisContractOk and scaleBroadcastOk",
76
+ "suffixAxisExactAffineOk": "suffixAxisContractOk and suffixScaleExactOk and suffixBiasExactOk",
77
+ "lastAxisScalarFastOk": "dtypes.T == \"f16\" or dim(shapes.X, -1) <= tunables.SCALAR_FAST_MAX_HIDDEN",
78
+ "noStatsOutputs": "not present.mean and not present.invStdDev",
79
+ "meanOnlyOutputs": "present.mean and not present.invStdDev",
80
+ "invStdOnlyOutputs": "not present.mean and present.invStdDev",
81
+ "fullStatsOutputs": "present.mean and present.invStdDev",
82
+ "statsRowsOk": "fullStatsOutputs and ranks.X >= 1 and numel(shapes.Mean) == normRows and numel(shapes.InvStdDev) == normRows",
83
+ "meanRowsOk": "present.mean and ranks.X >= 1 and numel(shapes.Mean) == normRows",
84
+ "invStdRowsOk": "present.invStdDev and ranks.X >= 1 and numel(shapes.InvStdDev) == normRows",
85
+ "statsOuterOk": "fullStatsOutputs and ranks.X >= 2 and numel(shapes.Mean) == normRows and numel(shapes.InvStdDev) == normRows"
86
+ },
87
+ "bindingSets": {
88
+ "vec4Affine": [
89
+ {
90
+ "name": "x",
91
+ "arg": "x",
92
+ "semantic": "X",
93
+ "buffer": { "type": "read-only-storage" },
94
+ "elementType": "$vectorScalar"
95
+ },
96
+ {
97
+ "name": "scale",
98
+ "arg": "scale",
99
+ "semantic": "Scale",
100
+ "buffer": { "type": "read-only-storage" },
101
+ "elementType": "$vectorScalar"
102
+ },
103
+ { "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" },
104
+ {
105
+ "name": "params",
106
+ "semantic": "kernel.params",
107
+ "buffer": { "type": "uniform" },
108
+ "struct": {
109
+ "name": "Params",
110
+ "fields": [
111
+ { "name": "rows", "type": "u32", "value": "normRows" },
112
+ { "name": "rowStride", "type": "u32", "value": "normRowStride" }
113
+ ]
114
+ }
115
+ }
116
+ ],
117
+ "vec4AffineBias": [
118
+ {
119
+ "name": "x",
120
+ "arg": "x",
121
+ "semantic": "X",
122
+ "buffer": { "type": "read-only-storage" },
123
+ "elementType": "$vectorScalar"
124
+ },
125
+ {
126
+ "name": "scale",
127
+ "arg": "scale",
128
+ "semantic": "Scale",
129
+ "buffer": { "type": "read-only-storage" },
130
+ "elementType": "$vectorScalar"
131
+ },
132
+ {
133
+ "name": "bias",
134
+ "arg": "b",
135
+ "semantic": "B",
136
+ "buffer": { "type": "read-only-storage" },
137
+ "elementType": "$vectorScalar"
138
+ },
139
+ { "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" },
140
+ {
141
+ "name": "params",
142
+ "semantic": "kernel.params",
143
+ "buffer": { "type": "uniform" },
144
+ "struct": {
145
+ "name": "Params",
146
+ "fields": [
147
+ { "name": "rows", "type": "u32", "value": "normRows" },
148
+ { "name": "rowStride", "type": "u32", "value": "normRowStride" }
149
+ ]
150
+ }
151
+ }
152
+ ],
153
+ "vec4AffineStats": [
154
+ {
155
+ "name": "x",
156
+ "arg": "x",
157
+ "semantic": "X",
158
+ "buffer": { "type": "read-only-storage" },
159
+ "elementType": "$vectorScalar"
160
+ },
161
+ {
162
+ "name": "scale",
163
+ "arg": "scale",
164
+ "semantic": "Scale",
165
+ "buffer": { "type": "read-only-storage" },
166
+ "elementType": "$vectorScalar"
167
+ },
168
+ { "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" },
169
+ { "name": "mean_out", "arg": "mean", "semantic": "Mean", "buffer": { "type": "storage" }, "elementType": "f32" },
170
+ {
171
+ "name": "inv_std_out",
172
+ "arg": "invStdDev",
173
+ "semantic": "InvStdDev",
174
+ "buffer": { "type": "storage" },
175
+ "elementType": "f32"
176
+ },
177
+ {
178
+ "name": "params",
179
+ "semantic": "kernel.params",
180
+ "buffer": { "type": "uniform" },
181
+ "struct": {
182
+ "name": "Params",
183
+ "fields": [
184
+ { "name": "rows", "type": "u32", "value": "normRows" },
185
+ { "name": "rowStride", "type": "u32", "value": "normRowStride" }
186
+ ]
187
+ }
188
+ }
189
+ ],
190
+ "vec4AffineBiasStats": [
191
+ {
192
+ "name": "x",
193
+ "arg": "x",
194
+ "semantic": "X",
195
+ "buffer": { "type": "read-only-storage" },
196
+ "elementType": "$vectorScalar"
197
+ },
198
+ {
199
+ "name": "scale",
200
+ "arg": "scale",
201
+ "semantic": "Scale",
202
+ "buffer": { "type": "read-only-storage" },
203
+ "elementType": "$vectorScalar"
204
+ },
205
+ {
206
+ "name": "bias",
207
+ "arg": "b",
208
+ "semantic": "B",
209
+ "buffer": { "type": "read-only-storage" },
210
+ "elementType": "$vectorScalar"
211
+ },
212
+ { "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" },
213
+ { "name": "mean_out", "arg": "mean", "semantic": "Mean", "buffer": { "type": "storage" }, "elementType": "f32" },
214
+ {
215
+ "name": "inv_std_out",
216
+ "arg": "invStdDev",
217
+ "semantic": "InvStdDev",
218
+ "buffer": { "type": "storage" },
219
+ "elementType": "f32"
220
+ },
221
+ {
222
+ "name": "params",
223
+ "semantic": "kernel.params",
224
+ "buffer": { "type": "uniform" },
225
+ "struct": {
226
+ "name": "Params",
227
+ "fields": [
228
+ { "name": "rows", "type": "u32", "value": "normRows" },
229
+ { "name": "rowStride", "type": "u32", "value": "normRowStride" }
230
+ ]
231
+ }
232
+ }
233
+ ],
234
+ "scalarAffineMean": [
235
+ { "name": "x", "arg": "x", "semantic": "X", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" },
236
+ {
237
+ "name": "scale",
238
+ "arg": "scale",
239
+ "semantic": "Scale",
240
+ "buffer": { "type": "read-only-storage" },
241
+ "elementType": "$scalar"
242
+ },
243
+ { "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$scalar" },
244
+ { "name": "mean_out", "arg": "mean", "semantic": "Mean", "buffer": { "type": "storage" }, "elementType": "f32" },
245
+ {
246
+ "name": "params",
247
+ "semantic": "kernel.params",
248
+ "buffer": { "type": "uniform" },
249
+ "struct": {
250
+ "name": "Params",
251
+ "fields": [
252
+ { "name": "rows", "type": "u32", "value": "normRows" },
253
+ { "name": "rowStride", "type": "u32", "value": "normRowStride" }
254
+ ]
255
+ }
256
+ }
257
+ ],
258
+ "scalarAffineInvStd": [
259
+ { "name": "x", "arg": "x", "semantic": "X", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" },
260
+ {
261
+ "name": "scale",
262
+ "arg": "scale",
263
+ "semantic": "Scale",
264
+ "buffer": { "type": "read-only-storage" },
265
+ "elementType": "$scalar"
266
+ },
267
+ { "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$scalar" },
268
+ {
269
+ "name": "inv_std_out",
270
+ "arg": "invStdDev",
271
+ "semantic": "InvStdDev",
272
+ "buffer": { "type": "storage" },
273
+ "elementType": "f32"
274
+ },
275
+ {
276
+ "name": "params",
277
+ "semantic": "kernel.params",
278
+ "buffer": { "type": "uniform" },
279
+ "struct": {
280
+ "name": "Params",
281
+ "fields": [
282
+ { "name": "rows", "type": "u32", "value": "normRows" },
283
+ { "name": "rowStride", "type": "u32", "value": "normRowStride" }
284
+ ]
285
+ }
286
+ }
287
+ ],
288
+ "scalarAffineBiasMean": [
289
+ { "name": "x", "arg": "x", "semantic": "X", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" },
290
+ {
291
+ "name": "scale",
292
+ "arg": "scale",
293
+ "semantic": "Scale",
294
+ "buffer": { "type": "read-only-storage" },
295
+ "elementType": "$scalar"
296
+ },
297
+ {
298
+ "name": "bias",
299
+ "arg": "b",
300
+ "semantic": "B",
301
+ "buffer": { "type": "read-only-storage" },
302
+ "elementType": "$scalar"
303
+ },
304
+ { "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$scalar" },
305
+ { "name": "mean_out", "arg": "mean", "semantic": "Mean", "buffer": { "type": "storage" }, "elementType": "f32" },
306
+ {
307
+ "name": "params",
308
+ "semantic": "kernel.params",
309
+ "buffer": { "type": "uniform" },
310
+ "struct": {
311
+ "name": "Params",
312
+ "fields": [
313
+ { "name": "rows", "type": "u32", "value": "normRows" },
314
+ { "name": "rowStride", "type": "u32", "value": "normRowStride" }
315
+ ]
316
+ }
317
+ }
318
+ ],
319
+ "scalarAffineBiasInvStd": [
320
+ { "name": "x", "arg": "x", "semantic": "X", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" },
321
+ {
322
+ "name": "scale",
323
+ "arg": "scale",
324
+ "semantic": "Scale",
325
+ "buffer": { "type": "read-only-storage" },
326
+ "elementType": "$scalar"
327
+ },
328
+ {
329
+ "name": "bias",
330
+ "arg": "b",
331
+ "semantic": "B",
332
+ "buffer": { "type": "read-only-storage" },
333
+ "elementType": "$scalar"
334
+ },
335
+ { "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$scalar" },
336
+ {
337
+ "name": "inv_std_out",
338
+ "arg": "invStdDev",
339
+ "semantic": "InvStdDev",
340
+ "buffer": { "type": "storage" },
341
+ "elementType": "f32"
342
+ },
343
+ {
344
+ "name": "params",
345
+ "semantic": "kernel.params",
346
+ "buffer": { "type": "uniform" },
347
+ "struct": {
348
+ "name": "Params",
349
+ "fields": [
350
+ { "name": "rows", "type": "u32", "value": "normRows" },
351
+ { "name": "rowStride", "type": "u32", "value": "normRowStride" }
352
+ ]
353
+ }
354
+ }
355
+ ]
356
+ },
357
+ "variants": [
358
+ {
359
+ "id": "last_axis_row_vec4",
360
+ "priority": 110,
361
+ "when": ["f16Ok(dtypes.T)", "not present.b and noStatsOutputs", "lastAxisExactScaleOk", "dim(shapes.X, -1) % 4 == 0"],
362
+ "constants": { "scalar": "dtypes.T", "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"" },
363
+ "passes": [
364
+ {
365
+ "id": "main",
366
+ "name": "LayerNormalization.LastAxisRowVec4",
367
+ "source": {
368
+ "shader": "norm-row-stats.wgsl.jinja",
369
+ "inputs": {
370
+ "mode": "\"layer\"",
371
+ "vec4": true,
372
+ "hasBias": false,
373
+ "writeStats": false,
374
+ "scalar": "dtypes.T",
375
+ "usesF16": "dtypes.T == \"f16\"",
376
+ "hidden": "dim(shapes.X, -1)",
377
+ "wg": "lastAxisWgVec4",
378
+ "epsilon": "attrs.epsilon",
379
+ "hiddenVec": "dim(shapes.X, -1) / 4",
380
+ "vecType": "\"vec4<\" ~ dtypes.T ~ \">\"",
381
+ "combineSubgroups": "hasSubgroupId"
382
+ }
383
+ },
384
+ "subgroupCollectivesWidth": "portable",
385
+ "bindings": "vec4Affine",
386
+ "dispatch": { "workgroups": "normRows" }
387
+ }
388
+ ]
389
+ },
390
+ {
391
+ "id": "last_axis_row",
392
+ "priority": 100,
393
+ "when": ["not present.b and noStatsOutputs", "lastAxisExactScaleOk", "f16Ok(dtypes.T)"],
394
+ "demoteWhen": ["not lastAxisScalarFastOk"],
395
+ "constants": { "scalar": "dtypes.T", "vectorScalar": "dtypes.T" },
396
+ "passes": [
397
+ {
398
+ "id": "main",
399
+ "name": "LayerNormalization.LastAxisRow",
400
+ "source": {
401
+ "shader": "norm-row-stats.wgsl.jinja",
402
+ "inputs": {
403
+ "mode": "\"layer\"",
404
+ "vec4": false,
405
+ "hasBias": false,
406
+ "writeStats": false,
407
+ "scalar": "dtypes.T",
408
+ "usesF16": "dtypes.T == \"f16\"",
409
+ "hidden": "dim(shapes.X, -1)",
410
+ "wg": "lastAxisWg",
411
+ "epsilon": "attrs.epsilon",
412
+ "combineSubgroups": "hasSubgroupId"
413
+ }
414
+ },
415
+ "subgroupCollectivesWidth": "portable",
416
+ "bindings": "vec4Affine",
417
+ "dispatch": { "workgroups": "normRows" }
418
+ }
419
+ ]
420
+ },
421
+ {
422
+ "id": "last_axis_bias_row_vec4",
423
+ "priority": 111,
424
+ "when": ["f16Ok(dtypes.T)", "present.b and noStatsOutputs and biasExactOk", "lastAxisExactScaleOk", "dim(shapes.X, -1) % 4 == 0"],
425
+ "constants": { "scalar": "dtypes.T", "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"" },
426
+ "passes": [
427
+ {
428
+ "id": "main",
429
+ "name": "LayerNormalization.LastAxisRowVec4",
430
+ "source": {
431
+ "shader": "norm-row-stats.wgsl.jinja",
432
+ "inputs": {
433
+ "mode": "\"layer\"",
434
+ "vec4": true,
435
+ "hasBias": true,
436
+ "writeStats": false,
437
+ "scalar": "dtypes.T",
438
+ "usesF16": "dtypes.T == \"f16\"",
439
+ "hidden": "dim(shapes.X, -1)",
440
+ "wg": "lastAxisWgVec4",
441
+ "epsilon": "attrs.epsilon",
442
+ "hiddenVec": "dim(shapes.X, -1) / 4",
443
+ "vecType": "\"vec4<\" ~ dtypes.T ~ \">\"",
444
+ "combineSubgroups": "hasSubgroupId"
445
+ }
446
+ },
447
+ "subgroupCollectivesWidth": "portable",
448
+ "bindings": "vec4AffineBias",
449
+ "dispatch": { "workgroups": "normRows" }
450
+ }
451
+ ]
452
+ },
453
+ {
454
+ "id": "last_axis_bias_row",
455
+ "priority": 101,
456
+ "when": ["present.b and noStatsOutputs and biasExactOk", "lastAxisExactScaleOk", "f16Ok(dtypes.T)"],
457
+ "demoteWhen": ["not lastAxisScalarFastOk"],
458
+ "constants": { "scalar": "dtypes.T", "vectorScalar": "dtypes.T" },
459
+ "passes": [
460
+ {
461
+ "id": "main",
462
+ "name": "LayerNormalization.LastAxisRow",
463
+ "source": {
464
+ "shader": "norm-row-stats.wgsl.jinja",
465
+ "inputs": {
466
+ "mode": "\"layer\"",
467
+ "vec4": false,
468
+ "hasBias": true,
469
+ "writeStats": false,
470
+ "scalar": "dtypes.T",
471
+ "usesF16": "dtypes.T == \"f16\"",
472
+ "hidden": "dim(shapes.X, -1)",
473
+ "wg": "lastAxisWg",
474
+ "epsilon": "attrs.epsilon",
475
+ "combineSubgroups": "hasSubgroupId"
476
+ }
477
+ },
478
+ "subgroupCollectivesWidth": "portable",
479
+ "bindings": "vec4AffineBias",
480
+ "dispatch": { "workgroups": "normRows" }
481
+ }
482
+ ]
483
+ },
484
+ {
485
+ "id": "last_axis_stats_row_vec4",
486
+ "priority": 112,
487
+ "when": ["f16Ok(dtypes.T)", "not present.b and fullStatsOutputs and statsRowsOk", "lastAxisExactScaleOk", "dim(shapes.X, -1) % 4 == 0"],
488
+ "constants": { "scalar": "dtypes.T", "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"" },
489
+ "passes": [
490
+ {
491
+ "id": "main",
492
+ "name": "LayerNormalization.LastAxisRowVec4",
493
+ "source": {
494
+ "shader": "norm-row-stats.wgsl.jinja",
495
+ "inputs": {
496
+ "mode": "\"layer\"",
497
+ "vec4": true,
498
+ "hasBias": false,
499
+ "writeStats": true,
500
+ "scalar": "dtypes.T",
501
+ "usesF16": "dtypes.T == \"f16\"",
502
+ "hidden": "dim(shapes.X, -1)",
503
+ "wg": "lastAxisWgVec4",
504
+ "epsilon": "attrs.epsilon",
505
+ "hiddenVec": "dim(shapes.X, -1) / 4",
506
+ "vecType": "\"vec4<\" ~ dtypes.T ~ \">\"",
507
+ "combineSubgroups": "hasSubgroupId"
508
+ }
509
+ },
510
+ "subgroupCollectivesWidth": "portable",
511
+ "bindings": "vec4AffineStats",
512
+ "dispatch": { "workgroups": "normRows" }
513
+ }
514
+ ]
515
+ },
516
+ {
517
+ "id": "last_axis_stats_row",
518
+ "priority": 102,
519
+ "when": ["not present.b and fullStatsOutputs and statsRowsOk", "lastAxisExactScaleOk", "f16Ok(dtypes.T)"],
520
+ "demoteWhen": ["not lastAxisScalarFastOk"],
521
+ "constants": { "scalar": "dtypes.T", "vectorScalar": "dtypes.T" },
522
+ "passes": [
523
+ {
524
+ "id": "main",
525
+ "name": "LayerNormalization.LastAxisRow",
526
+ "source": {
527
+ "shader": "norm-row-stats.wgsl.jinja",
528
+ "inputs": {
529
+ "mode": "\"layer\"",
530
+ "vec4": false,
531
+ "hasBias": false,
532
+ "writeStats": true,
533
+ "scalar": "dtypes.T",
534
+ "usesF16": "dtypes.T == \"f16\"",
535
+ "hidden": "dim(shapes.X, -1)",
536
+ "wg": "lastAxisWg",
537
+ "epsilon": "attrs.epsilon",
538
+ "combineSubgroups": "hasSubgroupId"
539
+ }
540
+ },
541
+ "subgroupCollectivesWidth": "portable",
542
+ "bindings": "vec4AffineStats",
543
+ "dispatch": { "workgroups": "normRows" }
544
+ }
545
+ ]
546
+ },
547
+ {
548
+ "id": "last_axis_bias_stats_row_vec4",
549
+ "priority": 113,
550
+ "when": ["f16Ok(dtypes.T)", "present.b and fullStatsOutputs and biasExactOk and statsRowsOk", "lastAxisExactScaleOk", "dim(shapes.X, -1) % 4 == 0"],
551
+ "constants": { "scalar": "dtypes.T", "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"" },
552
+ "passes": [
553
+ {
554
+ "id": "main",
555
+ "name": "LayerNormalization.LastAxisRowVec4",
556
+ "source": {
557
+ "shader": "norm-row-stats.wgsl.jinja",
558
+ "inputs": {
559
+ "mode": "\"layer\"",
560
+ "vec4": true,
561
+ "hasBias": true,
562
+ "writeStats": true,
563
+ "scalar": "dtypes.T",
564
+ "usesF16": "dtypes.T == \"f16\"",
565
+ "hidden": "dim(shapes.X, -1)",
566
+ "wg": "lastAxisWgVec4",
567
+ "epsilon": "attrs.epsilon",
568
+ "hiddenVec": "dim(shapes.X, -1) / 4",
569
+ "vecType": "\"vec4<\" ~ dtypes.T ~ \">\"",
570
+ "combineSubgroups": "hasSubgroupId"
571
+ }
572
+ },
573
+ "subgroupCollectivesWidth": "portable",
574
+ "bindings": "vec4AffineBiasStats",
575
+ "dispatch": { "workgroups": "normRows" }
576
+ }
577
+ ]
578
+ },
579
+ {
580
+ "id": "last_axis_bias_stats_row",
581
+ "priority": 103,
582
+ "when": ["present.b and fullStatsOutputs and biasExactOk and statsRowsOk", "lastAxisExactScaleOk", "f16Ok(dtypes.T)"],
583
+ "demoteWhen": ["not lastAxisScalarFastOk"],
584
+ "constants": { "scalar": "dtypes.T", "vectorScalar": "dtypes.T" },
585
+ "passes": [
586
+ {
587
+ "id": "main",
588
+ "name": "LayerNormalization.LastAxisRow",
589
+ "source": {
590
+ "shader": "norm-row-stats.wgsl.jinja",
591
+ "inputs": {
592
+ "mode": "\"layer\"",
593
+ "vec4": false,
594
+ "hasBias": true,
595
+ "writeStats": true,
596
+ "scalar": "dtypes.T",
597
+ "usesF16": "dtypes.T == \"f16\"",
598
+ "hidden": "dim(shapes.X, -1)",
599
+ "wg": "lastAxisWg",
600
+ "epsilon": "attrs.epsilon",
601
+ "combineSubgroups": "hasSubgroupId"
602
+ }
603
+ },
604
+ "subgroupCollectivesWidth": "portable",
605
+ "bindings": "vec4AffineBiasStats",
606
+ "dispatch": { "workgroups": "normRows" }
607
+ }
608
+ ]
609
+ },
610
+ {
611
+ "id": "suffix_axis_bias_exact_row_vec4",
612
+ "priority": 121,
613
+ "when": ["f16Ok(dtypes.T)", "present.b", "noStatsOutputs", "suffixAxisExactAffineOk", "suffixAxisSize % 4 == 0"],
614
+ "constants": { "scalar": "dtypes.T", "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"" },
615
+ "passes": [
616
+ {
617
+ "id": "main",
618
+ "name": "LayerNormalization.SuffixAxisRowVec4",
619
+ "source": {
620
+ "shader": "norm-row-stats.wgsl.jinja",
621
+ "inputs": {
622
+ "mode": "\"layer\"",
623
+ "vec4": true,
624
+ "hasBias": true,
625
+ "writeStats": false,
626
+ "scalar": "dtypes.T",
627
+ "usesF16": "dtypes.T == \"f16\"",
628
+ "hidden": "suffixAxisSize",
629
+ "wg": "suffixAxisWgVec4",
630
+ "epsilon": "attrs.epsilon",
631
+ "hiddenVec": "suffixAxisSize / 4",
632
+ "vecType": "\"vec4<\" ~ dtypes.T ~ \">\"",
633
+ "combineSubgroups": "hasSubgroupId"
634
+ }
635
+ },
636
+ "subgroupCollectivesWidth": "portable",
637
+ "bindings": "vec4AffineBias",
638
+ "dispatch": { "workgroups": "normRows" }
639
+ }
640
+ ]
641
+ },
642
+ {
643
+ "id": "last_axis",
644
+ "priority": 0,
645
+ "when": ["not present.b", "noStatsOutputs", "lastAxisBroadcastScaleOk", "f16Ok(dtypes.T)"],
646
+ "constants": {
647
+ "hasBias": false,
648
+ "writeMean": false,
649
+ "writeInvStdDev": false,
650
+ "scalar": "dtypes.T",
651
+ "vectorScalar": "dtypes.T",
652
+ "usesF16": "dtypes.T == \"f16\"",
653
+ "hiddenSize": "dim(shapes.X, -1)",
654
+ "workgroupSize": "lastAxisWg",
655
+ "epsilon": "attrs.epsilon"
656
+ },
657
+ "passes": [
658
+ {
659
+ "id": "main",
660
+ "name": "LayerNormalization",
661
+ "source": {
662
+ "shader": "layer-normalization.wgsl.jinja",
663
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale" }
664
+ },
665
+ "bindings": "vec4Affine",
666
+ "dispatch": { "workgroups": "normRows" }
667
+ }
668
+ ]
669
+ },
670
+ {
671
+ "id": "last_axis_bias",
672
+ "priority": 10,
673
+ "when": ["present.b", "noStatsOutputs", "lastAxisBroadcastScaleOk", "biasBroadcastOk", "f16Ok(dtypes.T)"],
674
+ "constants": {
675
+ "hasBias": true,
676
+ "writeMean": false,
677
+ "writeInvStdDev": false,
678
+ "scalar": "dtypes.T",
679
+ "vectorScalar": "dtypes.T",
680
+ "usesF16": "dtypes.T == \"f16\"",
681
+ "hiddenSize": "dim(shapes.X, -1)",
682
+ "workgroupSize": "lastAxisWg",
683
+ "epsilon": "attrs.epsilon"
684
+ },
685
+ "passes": [
686
+ {
687
+ "id": "main",
688
+ "name": "LayerNormalization",
689
+ "source": {
690
+ "shader": "layer-normalization.wgsl.jinja",
691
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale", "biasShape": "shapes.B" }
692
+ },
693
+ "bindings": "vec4AffineBias",
694
+ "dispatch": { "workgroups": "normRows" }
695
+ }
696
+ ]
697
+ },
698
+ {
699
+ "id": "last_axis_stats",
700
+ "priority": 20,
701
+ "when": ["not present.b", "fullStatsOutputs", "lastAxisBroadcastScaleOk", "statsRowsOk", "f16Ok(dtypes.T)"],
702
+ "constants": {
703
+ "hasBias": false,
704
+ "writeMean": true,
705
+ "writeInvStdDev": true,
706
+ "scalar": "dtypes.T",
707
+ "vectorScalar": "dtypes.T",
708
+ "usesF16": "dtypes.T == \"f16\"",
709
+ "hiddenSize": "dim(shapes.X, -1)",
710
+ "workgroupSize": "lastAxisWg",
711
+ "epsilon": "attrs.epsilon"
712
+ },
713
+ "passes": [
714
+ {
715
+ "id": "main",
716
+ "name": "LayerNormalization",
717
+ "source": {
718
+ "shader": "layer-normalization.wgsl.jinja",
719
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale" }
720
+ },
721
+ "bindings": "vec4AffineStats",
722
+ "dispatch": { "workgroups": "normRows" }
723
+ }
724
+ ]
725
+ },
726
+ {
727
+ "id": "last_axis_bias_stats",
728
+ "priority": 30,
729
+ "when": ["present.b", "fullStatsOutputs", "lastAxisBroadcastScaleOk", "biasBroadcastOk", "statsRowsOk", "f16Ok(dtypes.T)"],
730
+ "constants": {
731
+ "hasBias": true,
732
+ "writeMean": true,
733
+ "writeInvStdDev": true,
734
+ "scalar": "dtypes.T",
735
+ "vectorScalar": "dtypes.T",
736
+ "usesF16": "dtypes.T == \"f16\"",
737
+ "hiddenSize": "dim(shapes.X, -1)",
738
+ "workgroupSize": "lastAxisWg",
739
+ "epsilon": "attrs.epsilon"
740
+ },
741
+ "passes": [
742
+ {
743
+ "id": "main",
744
+ "name": "LayerNormalization",
745
+ "source": {
746
+ "shader": "layer-normalization.wgsl.jinja",
747
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale", "biasShape": "shapes.B" }
748
+ },
749
+ "bindings": "vec4AffineBiasStats",
750
+ "dispatch": { "workgroups": "normRows" }
751
+ }
752
+ ]
753
+ },
754
+ {
755
+ "id": "suffix_axis",
756
+ "priority": 40,
757
+ "when": ["not present.b", "noStatsOutputs", "suffixAxisBroadcastScaleOk", "f16Ok(dtypes.T)"],
758
+ "constants": {
759
+ "hasBias": false,
760
+ "writeMean": false,
761
+ "writeInvStdDev": false,
762
+ "scalar": "dtypes.T",
763
+ "vectorScalar": "dtypes.T",
764
+ "usesF16": "dtypes.T == \"f16\"",
765
+ "hiddenSize": "suffixAxisSize",
766
+ "workgroupSize": "suffixAxisWg",
767
+ "epsilon": "attrs.epsilon"
768
+ },
769
+ "passes": [
770
+ {
771
+ "id": "main",
772
+ "name": "LayerNormalization.SuffixAxis",
773
+ "source": {
774
+ "shader": "layer-normalization.wgsl.jinja",
775
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale" }
776
+ },
777
+ "bindings": "vec4Affine",
778
+ "dispatch": { "workgroups": "normRows" }
779
+ }
780
+ ]
781
+ },
782
+ {
783
+ "id": "suffix_axis_bias",
784
+ "priority": 50,
785
+ "when": ["present.b", "noStatsOutputs", "suffixAxisBroadcastScaleOk", "biasBroadcastOk", "f16Ok(dtypes.T)"],
786
+ "constants": {
787
+ "hasBias": true,
788
+ "writeMean": false,
789
+ "writeInvStdDev": false,
790
+ "scalar": "dtypes.T",
791
+ "vectorScalar": "dtypes.T",
792
+ "usesF16": "dtypes.T == \"f16\"",
793
+ "hiddenSize": "suffixAxisSize",
794
+ "workgroupSize": "suffixAxisWg",
795
+ "epsilon": "attrs.epsilon"
796
+ },
797
+ "passes": [
798
+ {
799
+ "id": "main",
800
+ "name": "LayerNormalization.SuffixAxisBias",
801
+ "source": {
802
+ "shader": "layer-normalization.wgsl.jinja",
803
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale", "biasShape": "shapes.B" }
804
+ },
805
+ "bindings": "vec4AffineBias",
806
+ "dispatch": { "workgroups": "normRows" }
807
+ }
808
+ ]
809
+ },
810
+ {
811
+ "id": "suffix_axis_stats",
812
+ "priority": 45,
813
+ "when": ["not present.b", "fullStatsOutputs", "suffixAxisBroadcastScaleOk", "statsOuterOk", "f16Ok(dtypes.T)"],
814
+ "constants": {
815
+ "hasBias": false,
816
+ "writeMean": true,
817
+ "writeInvStdDev": true,
818
+ "scalar": "dtypes.T",
819
+ "vectorScalar": "dtypes.T",
820
+ "usesF16": "dtypes.T == \"f16\"",
821
+ "hiddenSize": "suffixAxisSize",
822
+ "workgroupSize": "suffixAxisWg",
823
+ "epsilon": "attrs.epsilon"
824
+ },
825
+ "passes": [
826
+ {
827
+ "id": "main",
828
+ "name": "LayerNormalization.SuffixAxisStats",
829
+ "source": {
830
+ "shader": "layer-normalization.wgsl.jinja",
831
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale" }
832
+ },
833
+ "bindings": "vec4AffineStats",
834
+ "dispatch": { "workgroups": "normRows" }
835
+ }
836
+ ]
837
+ },
838
+ {
839
+ "id": "suffix_axis_bias_stats",
840
+ "priority": 55,
841
+ "when": ["present.b", "fullStatsOutputs", "suffixAxisBroadcastScaleOk", "biasBroadcastOk", "statsOuterOk", "f16Ok(dtypes.T)"],
842
+ "constants": {
843
+ "hasBias": true,
844
+ "writeMean": true,
845
+ "writeInvStdDev": true,
846
+ "scalar": "dtypes.T",
847
+ "vectorScalar": "dtypes.T",
848
+ "usesF16": "dtypes.T == \"f16\"",
849
+ "hiddenSize": "suffixAxisSize",
850
+ "workgroupSize": "suffixAxisWg",
851
+ "epsilon": "attrs.epsilon"
852
+ },
853
+ "passes": [
854
+ {
855
+ "id": "main",
856
+ "name": "LayerNormalization.SuffixAxisBiasStats",
857
+ "source": {
858
+ "shader": "layer-normalization.wgsl.jinja",
859
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale", "biasShape": "shapes.B" }
860
+ },
861
+ "bindings": "vec4AffineBiasStats",
862
+ "dispatch": { "workgroups": "normRows" }
863
+ }
864
+ ]
865
+ },
866
+ {
867
+ "id": "mean_only",
868
+ "priority": 31,
869
+ "when": ["not present.b and meanOnlyOutputs and meanRowsOk", "lastAxisBroadcastScaleOk or suffixAxisBroadcastScaleOk", "f16Ok(dtypes.T)"],
870
+ "constants": {
871
+ "hasBias": false,
872
+ "writeMean": true,
873
+ "writeInvStdDev": false,
874
+ "scalar": "dtypes.T",
875
+ "usesF16": "dtypes.T == \"f16\"",
876
+ "hiddenSize": "genericHiddenSize",
877
+ "workgroupSize": "genericWorkgroupSize",
878
+ "epsilon": "attrs.epsilon"
879
+ },
880
+ "passes": [
881
+ {
882
+ "id": "main",
883
+ "name": "LayerNormalization.MeanOnly",
884
+ "source": {
885
+ "shader": "layer-normalization.wgsl.jinja",
886
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale" }
887
+ },
888
+ "bindings": "scalarAffineMean",
889
+ "dispatch": { "workgroups": "normRows" }
890
+ }
891
+ ]
892
+ },
893
+ {
894
+ "id": "bias_mean_only",
895
+ "priority": 32,
896
+ "when": ["present.b and meanOnlyOutputs and biasBroadcastOk and meanRowsOk", "lastAxisBroadcastScaleOk or suffixAxisBroadcastScaleOk", "f16Ok(dtypes.T)"],
897
+ "constants": {
898
+ "hasBias": true,
899
+ "writeMean": true,
900
+ "writeInvStdDev": false,
901
+ "scalar": "dtypes.T",
902
+ "usesF16": "dtypes.T == \"f16\"",
903
+ "hiddenSize": "genericHiddenSize",
904
+ "workgroupSize": "genericWorkgroupSize",
905
+ "epsilon": "attrs.epsilon"
906
+ },
907
+ "passes": [
908
+ {
909
+ "id": "main",
910
+ "name": "LayerNormalization.BiasMeanOnly",
911
+ "source": {
912
+ "shader": "layer-normalization.wgsl.jinja",
913
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale", "biasShape": "shapes.B" }
914
+ },
915
+ "bindings": "scalarAffineBiasMean",
916
+ "dispatch": { "workgroups": "normRows" }
917
+ }
918
+ ]
919
+ },
920
+ {
921
+ "id": "inv_std_dev_only",
922
+ "priority": 33,
923
+ "when": ["not present.b and invStdOnlyOutputs and invStdRowsOk", "lastAxisBroadcastScaleOk or suffixAxisBroadcastScaleOk", "f16Ok(dtypes.T)"],
924
+ "constants": {
925
+ "hasBias": false,
926
+ "writeMean": false,
927
+ "writeInvStdDev": true,
928
+ "scalar": "dtypes.T",
929
+ "usesF16": "dtypes.T == \"f16\"",
930
+ "hiddenSize": "genericHiddenSize",
931
+ "workgroupSize": "genericWorkgroupSize",
932
+ "epsilon": "attrs.epsilon"
933
+ },
934
+ "passes": [
935
+ {
936
+ "id": "main",
937
+ "name": "LayerNormalization.InvStdDevOnly",
938
+ "source": {
939
+ "shader": "layer-normalization.wgsl.jinja",
940
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale" }
941
+ },
942
+ "bindings": "scalarAffineInvStd",
943
+ "dispatch": { "workgroups": "normRows" }
944
+ }
945
+ ]
946
+ },
947
+ {
948
+ "id": "bias_inv_std_dev_only",
949
+ "priority": 34,
950
+ "when": ["present.b and invStdOnlyOutputs and biasBroadcastOk and invStdRowsOk", "lastAxisBroadcastScaleOk or suffixAxisBroadcastScaleOk", "f16Ok(dtypes.T)"],
951
+ "constants": {
952
+ "hasBias": true,
953
+ "writeMean": false,
954
+ "writeInvStdDev": true,
955
+ "scalar": "dtypes.T",
956
+ "usesF16": "dtypes.T == \"f16\"",
957
+ "hiddenSize": "genericHiddenSize",
958
+ "workgroupSize": "genericWorkgroupSize",
959
+ "epsilon": "attrs.epsilon"
960
+ },
961
+ "passes": [
962
+ {
963
+ "id": "main",
964
+ "name": "LayerNormalization.BiasInvStdDevOnly",
965
+ "source": {
966
+ "shader": "layer-normalization.wgsl.jinja",
967
+ "inputs": { "xShape": "shapes.X", "scaleShape": "shapes.Scale", "biasShape": "shapes.B" }
968
+ },
969
+ "bindings": "scalarAffineBiasInvStd",
970
+ "dispatch": { "workgroups": "normRows" }
971
+ }
972
+ ]
973
+ }
974
+ ]
975
+ }
build/webgpu/metadata.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "ai.onnx.LayerNormalization",
3
+ "id": "_ai_onnx_layernormalization_webgpu_af1721d",
4
+ "version": 1,
5
+ "license": "Apache-2.0",
6
+ "backend": { "type": "webgpu" },
7
+ "digest": {
8
+ "algorithm": "sha256",
9
+ "files": {
10
+ "bench.json": "fLkWXUeB9lfy8s03WLvcd2LRTBWce01Yzzv5lBHMvig=",
11
+ "layer-normalization.wgsl.jinja": "3BXN4VIAbNR6se39KXKK5jV514N8v756GeH37Tsuzi0=",
12
+ "manifest.json": "j8ogYGGt7G1Pr0St9Gyhpff035GfQKHmuz6IBktIrV8=",
13
+ "norm-row-stats.wgsl.jinja": "82e5r5vFGd0ylf/r3n+fucFbRPPMH3II1VBaTTKSkp4=",
14
+ "test.json": "hjj+HEnuQ0NKto1gCH5+81D7bWaH+hgQWy5OlySa7C0="
15
+ }
16
+ },
17
+ "provenance": { "kernel": { "sha": "2e7068faf55e7f43df740015f6d1ee49391a41c5", "dirty": false } },
18
+ "webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.LayerNormalization" }
19
+ }
build/webgpu/norm-row-stats.wgsl.jinja ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% if source.usesF16 %}
2
+ enable f16;
3
+ {% endif %}
4
+ {% set combineSubgroups = source.combineSubgroups %}
5
+ {% set scalarIo = source.scalarIo if source.scalarIo is defined else false %}
6
+ {% set writeStats = source.writeStats if source.writeStats is defined else false %}
7
+ {% set reduceThreadParameters = ", sg_lane: u32, sg_id: u32, num_sg: u32"
8
+ if combineSubgroups else ", tid: u32" %}
9
+ {% set reduceThreadArguments = ", sg_lane, sg_id, num_sg"
10
+ if combineSubgroups else ", tid" %}
11
+ {% if combineSubgroups %}
12
+ enable subgroups;
13
+ {% endif %}
14
+ {{ env.wgsl.resourceDeclarations }}
15
+
16
+ // Workgroup-parallel single-pass row statistics + fused normalize/affine.
17
+ //
18
+ // One workgroup owns one contiguous normalization span ("row": a last-axis
19
+ // row, an instance plane, or a channel group). Threads stride the row once,
20
+ // accumulating (sum, sum_sq) simultaneously. Partials are reduced either with
21
+ // subgroupAdd plus a shared-memory combine or with a portable shared-memory
22
+ // tree, then every thread applies the fused normalize + affine write.
23
+ //
24
+ // Shifted moments avoid cancellation from a large common offset; scaling uses
25
+ // inverseSqrt(variance + EPSILON).
26
+ const HIDDEN: u32 = {{ source.hidden }}u;
27
+ {% if source.vec4 %}
28
+ const HIDDEN_V: u32 = {{ source.hiddenVec }}u;
29
+ {% endif %}
30
+ const WG: u32 = {{ source.wg }}u;
31
+ const EPSILON: f32 = {{ source.epsilon }};
32
+
33
+
34
+
35
+ {% if combineSubgroups %}
36
+ var<workgroup> sg_partials: array<vec2<f32>, WG>;
37
+
38
+ fn reduce_pair(value: vec2<f32>{{ reduceThreadParameters }}) -> vec2<f32> {
39
+ let s = vec2<f32>(subgroupAdd(value.x), subgroupAdd(value.y));
40
+ if (num_sg == 1u) {
41
+ return s;
42
+ }
43
+ if (sg_lane == 0u) {
44
+ sg_partials[sg_id] = s;
45
+ }
46
+ workgroupBarrier();
47
+ var total = vec2<f32>(0.0);
48
+ for (var i = 0u; i < num_sg; i++) {
49
+ total += sg_partials[i];
50
+ }
51
+ return total;
52
+ }
53
+ {% else %}
54
+ // Each shared-memory tree reduction deliberately ends with a barrier. It keeps
55
+ // lanes that have read the result from starting a later reduction and
56
+ // overwriting scratch while slower lanes are still reading it.
57
+ var<workgroup> tr0: array<f32, WG>;
58
+ var<workgroup> tr1: array<f32, WG>;
59
+ fn reduce_pair(value: vec2<f32>, tid: u32) -> vec2<f32> {
60
+ tr0[tid] = value.x;
61
+ tr1[tid] = value.y;
62
+ workgroupBarrier();
63
+ var stride: u32 = WG / 2u;
64
+ loop {
65
+ if (stride == 0u) { break; }
66
+ if (tid < stride) {
67
+ tr0[tid] = tr0[tid] + tr0[tid + stride];
68
+ tr1[tid] = tr1[tid] + tr1[tid + stride];
69
+ }
70
+ stride = stride / 2u;
71
+ workgroupBarrier();
72
+ }
73
+ let reduced = vec2<f32>(tr0[0], tr1[0]);
74
+ workgroupBarrier();
75
+ return reduced;
76
+ }
77
+ {% endif %}
78
+
79
+ @compute @workgroup_size(WG, 1, 1)
80
+ fn main(
81
+ @builtin(workgroup_id) wg_id: vec3<u32>,
82
+ @builtin(local_invocation_id) lid: vec3<u32>{% if combineSubgroups %},
83
+ @builtin(subgroup_invocation_id) sg_lane: u32,
84
+ @builtin(subgroup_id) sg_id: u32,
85
+ @builtin(num_subgroups) num_sg: u32{% endif %}
86
+ ) {
87
+ let row = wg_id.x + wg_id.y * params.rowStride;
88
+ if (row >= params.rows) {
89
+ return;
90
+ }
91
+ let tid = lid.x;
92
+ {% if source.vec4 and not scalarIo %}
93
+ let base = row * HIDDEN_V;
94
+ {% else %}
95
+ let base = row * HIDDEN;
96
+ {% endif %}
97
+
98
+ {% if source.vec4 %}
99
+ let shift = f32(x[base].x);
100
+ {% else %}
101
+ let shift = f32(x[base]);
102
+ {% endif %}
103
+
104
+ var acc = vec2<f32>(0.0, 0.0);
105
+ {% if source.vec4 %}
106
+ for (var i = tid; i < HIDDEN_V; i = i + WG) {
107
+ let v = vec4<f32>(x[base + i]);
108
+ let d = v - vec4<f32>(shift);
109
+ acc.x = acc.x + d.x + d.y + d.z + d.w;
110
+ acc.y = acc.y + dot(d, d);
111
+ }
112
+ {% else %}
113
+ for (var i = tid; i < HIDDEN; i = i + WG) {
114
+ let v = f32(x[base + i]);
115
+ let d = v - shift;
116
+ acc.x = acc.x + d;
117
+ acc.y = acc.y + d * d;
118
+ }
119
+ {% endif %}
120
+
121
+ let totals = reduce_pair(acc{{ reduceThreadArguments }});
122
+
123
+ let mean_d = totals.x / f32(HIDDEN);
124
+ let variance = max(totals.y / f32(HIDDEN) - mean_d * mean_d, 0.0);
125
+ let inv = inverseSqrt(variance + EPSILON);
126
+ let row_mean = shift + mean_d;
127
+ {% if writeStats %}
128
+ if (tid == 0u) {
129
+ mean_out[row] = row_mean;
130
+ inv_std_out[row] = inv;
131
+ }
132
+ {% endif %}
133
+
134
+ {% if source.vec4 %}
135
+ for (var i = tid; i < HIDDEN_V; i = i + WG) {
136
+ let idx = base + i;
137
+ let v = vec4<f32>(x[idx]);
138
+ var value = (v - vec4<f32>(row_mean)) * inv * vec4<f32>(scale[i]);
139
+ {% if source.hasBias %}
140
+ value = value + vec4<f32>(bias[i]);
141
+ {% endif %}
142
+ y[idx] = {{ source.vecType }}(value);
143
+ }
144
+ {% else %}
145
+ for (var i = tid; i < HIDDEN; i = i + WG) {
146
+ let idx = base + i;
147
+ let v = f32(x[idx]);
148
+ var value = (v - row_mean) * inv * f32(scale[i]);
149
+ {% if source.hasBias %}
150
+ value = value + f32(bias[i]);
151
+ {% endif %}
152
+ y[idx] = {{ source.scalar }}(value);
153
+ }
154
+ {% endif %}
155
+ }
build/webgpu/test.json ADDED
@@ -0,0 +1,1786 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "op": "ai.onnx.LayerNormalization",
3
+ "fixtureArrays": {
4
+ "onnx_backend_layer_normalization_3d_input_x": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322, 0.7610377073287964, 0.12167501449584961, 0.44386324286460876, 0.3336743414402008, 1.4940791130065918, -0.2051582634449005, 0.3130677044391632, -0.8540957570075989, -2.5529897212982178, 0.653618574142456, 0.8644362092018127, -0.7421650290489197, 2.269754648208618, -1.4543657302856445, 0.04575851559638977, -0.18718385696411133, 1.5327792167663574, 1.4693588018417358],
5
+ "onnx_backend_layer_normalization_input_x": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322, 0.7610377073287964, 0.12167501449584961, 0.44386324286460876, 0.3336743414402008, 1.4940791130065918, -0.2051582634449005, 0.3130677044391632, -0.8540957570075989, -2.5529897212982178, 0.653618574142456, 0.8644362092018127, -0.7421650290489197, 2.269754648208618, -1.4543657302856445, 0.04575851559638977, -0.18718385696411133, 1.5327792167663574, 1.4693588018417358, 0.154947429895401, 0.37816253304481506, -0.8877857327461243, -1.980796456336975, -0.34791216254234314, 0.15634897351264954, 1.2302906513214111, 1.202379822731018, -0.38732680678367615, -0.302302747964859, -1.0485529899597168, -1.420017957687378, -1.7062702178955078, 1.950775384902954, -0.5096521973609924, -0.4380742907524109, -1.2527953386306763, 0.7774903774261475, -1.6138978004455566, -0.21274028718471527, -0.8954665660858154, 0.38690251111984253, -0.5108051300048828, -1.18063223361969, -0.02818222902715206, 0.4283318817615509, 0.06651721894741058, 0.30247190594673157, -0.6343221068382263, -0.3627411723136902, -0.6724604368209839, -0.35955315828323364, -0.8131462931632996, -1.7262825965881348, 0.17742614448070526, -0.4017809331417084, -1.630198359489441, 0.46278226375579834, -0.9072983860969543, 0.05194539576768875, 0.7290905714035034, 0.12898291647434235, 1.1394007205963135, -1.234825849533081, 0.4023416340351105, -0.6848101019859314, -0.8707971572875977, -0.5788496732711792, -0.3115525245666504, 0.056165341287851334, -1.1651498079299927, 0.9008265137672424, 0.4656624495983124, -1.5362436771392822, 1.4882521629333496, 1.895889163017273, 1.1787796020507812, -0.1799248307943344, -1.0707526206970215, 1.0544517040252686, -0.4031769335269928, 1.222445011138916, 0.2082749754190445, 0.9766390323638916, 0.3563663959503174, 0.7065731883049011, 0.01050002034753561, 1.7858705520629883, 0.12691208720207214, 0.4019893705844879, 1.8831506967544556, -1.3477590084075928, -1.2704850435256958, 0.969396710395813, -1.1731233596801758, 1.9436211585998535, -0.4136189818382263, -0.747454822063446, 1.922942042350769, 1.4805147647857666, 1.8675589561462402, 0.9060446619987488, -0.8612256646156311, 1.910064935684204, -0.26800337433815, 0.8024563789367676, 0.9472519755363464, -0.15501008927822113, 0.6140793561935425, 0.922206699848175]
6
+ },
7
+ "cases": [
8
+ {
9
+ "name": "subgroup_vec4_stats_no_bias_2x512",
10
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
11
+ "inputs": {
12
+ "x": {
13
+ "dtype": "float32",
14
+ "shape": [2, 512],
15
+ "data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.21 }
16
+ },
17
+ "scale": {
18
+ "dtype": "float32",
19
+ "shape": [512],
20
+ "data": { "kind": "fillFloat32", "sinStep": 0.29, "cosStep": 0.11, "scale": 0.5 }
21
+ }
22
+ },
23
+ "outputs": {
24
+ "y": { "dtype": "float32", "shape": [2, 512], "tolerance": 0.000002 },
25
+ "mean": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 },
26
+ "invStdDev": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.00001 }
27
+ }
28
+ },
29
+ {
30
+ "name": "subgroup_vec4_bias_2x512",
31
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
32
+ "inputs": {
33
+ "x": {
34
+ "dtype": "float32",
35
+ "shape": [2, 512],
36
+ "data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.23 }
37
+ },
38
+ "scale": {
39
+ "dtype": "float32",
40
+ "shape": [512],
41
+ "data": { "kind": "fillFloat32", "sinStep": 0.31, "cosStep": 0.07, "scale": 0.4 }
42
+ },
43
+ "b": {
44
+ "dtype": "float32",
45
+ "shape": [512],
46
+ "data": { "kind": "fillFloat32", "sinStep": 0.05, "cosStep": 0.19, "scale": 0.25 }
47
+ }
48
+ },
49
+ "outputs": { "y": { "dtype": "float32", "shape": [2, 512], "tolerance": 0.000002 } }
50
+ },
51
+ {
52
+ "name": "subgroup_vec4_f16_4x32",
53
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
54
+ "inputs": {
55
+ "x": {
56
+ "dtype": "float16",
57
+ "shape": [4, 32],
58
+ "data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.27 }
59
+ },
60
+ "scale": {
61
+ "dtype": "float16",
62
+ "shape": [32],
63
+ "data": { "kind": "fillFloat32", "sinStep": 0.21, "cosStep": 0.13, "scale": 0.5 }
64
+ }
65
+ },
66
+ "outputs": { "y": { "dtype": "float16", "shape": [4, 32], "tolerance": 0.005 } }
67
+ },
68
+ {
69
+ "name": "subgroup_vec4_f16_stats_4x32",
70
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
71
+ "inputs": {
72
+ "x": {
73
+ "dtype": "float16",
74
+ "shape": [4, 32],
75
+ "data": { "kind": "fillFloat32", "sinStep": 0.09, "cosStep": 0.19 }
76
+ },
77
+ "scale": {
78
+ "dtype": "float16",
79
+ "shape": [32],
80
+ "data": { "kind": "fillFloat32", "sinStep": 0.23, "cosStep": 0.17, "scale": 0.45 }
81
+ }
82
+ },
83
+ "outputs": {
84
+ "y": { "dtype": "float16", "shape": [4, 32], "tolerance": 0.006 },
85
+ "mean": { "dtype": "float32", "shape": [4, 1], "tolerance": 0.002 },
86
+ "invStdDev": { "dtype": "float32", "shape": [4, 1], "tolerance": 0.02 }
87
+ }
88
+ },
89
+ {
90
+ "name": "subgroup_vec4_f16_bias_4x32",
91
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
92
+ "inputs": {
93
+ "x": {
94
+ "dtype": "float16",
95
+ "shape": [4, 32],
96
+ "data": { "kind": "fillFloat32", "sinStep": 0.15, "cosStep": 0.25 }
97
+ },
98
+ "scale": {
99
+ "dtype": "float16",
100
+ "shape": [32],
101
+ "data": { "kind": "fillFloat32", "sinStep": 0.27, "cosStep": 0.09, "scale": 0.45 }
102
+ },
103
+ "b": {
104
+ "dtype": "float16",
105
+ "shape": [32],
106
+ "data": { "kind": "fillFloat32", "sinStep": 0.07, "cosStep": 0.21, "scale": 0.2 }
107
+ }
108
+ },
109
+ "outputs": { "y": { "dtype": "float16", "shape": [4, 32], "tolerance": 0.006 } }
110
+ },
111
+ {
112
+ "name": "subgroup_vec4_f16_bias_stats_4x32",
113
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
114
+ "inputs": {
115
+ "x": {
116
+ "dtype": "float16",
117
+ "shape": [4, 32],
118
+ "data": { "kind": "fillFloat32", "sinStep": 0.12, "cosStep": 0.29 }
119
+ },
120
+ "scale": {
121
+ "dtype": "float16",
122
+ "shape": [32],
123
+ "data": { "kind": "fillFloat32", "sinStep": 0.25, "cosStep": 0.11, "scale": 0.4 }
124
+ },
125
+ "b": {
126
+ "dtype": "float16",
127
+ "shape": [32],
128
+ "data": { "kind": "fillFloat32", "sinStep": 0.05, "cosStep": 0.17, "scale": 0.25 }
129
+ }
130
+ },
131
+ "outputs": {
132
+ "y": { "dtype": "float16", "shape": [4, 32], "tolerance": 0.006 },
133
+ "mean": { "dtype": "float32", "shape": [4, 1], "tolerance": 0.002 },
134
+ "invStdDev": { "dtype": "float32", "shape": [4, 1], "tolerance": 0.02 }
135
+ }
136
+ },
137
+ {
138
+ "name": "f32_subnormal_scale_preserves_tiny_outputs_gpu_gap",
139
+ "skipGpu": {
140
+ "category": "permanent",
141
+ "reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal values required by this fixture. Backend evidence: WebGPU/Metal flushes subnormals to zero in f32; the subnormal per-element scale collapses so tiny normalized outputs cannot be preserved."
142
+ },
143
+ "provenance": {
144
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
145
+ "test": "LayerNormalization",
146
+ "notes": "A valid subnormal scale should produce finite subnormal normalized outputs rather than being flushed to zero."
147
+ },
148
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
149
+ "inputs": {
150
+ "x": { "dtype": "float32", "shape": [1, 4], "data": { "kind": "values", "values": [-1.0, 0.0, 1.0, 2.0] } },
151
+ "scale": {
152
+ "dtype": "float32",
153
+ "shape": [4],
154
+ "data": { "kind": "values", "values": [1e-40, 2e-40, -3e-40, 4e-40] }
155
+ }
156
+ },
157
+ "outputs": { "y": { "dtype": "float32", "shape": [1, 4], "tolerance": 1e-44 } }
158
+ },
159
+ {
160
+ "name": "f32_subnormal_scale_preserves_tiny_outputs_odd_hidden_gpu_gap",
161
+ "skipGpu": {
162
+ "category": "permanent",
163
+ "reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal values required by this fixture. Backend evidence: WebGPU/Metal flushes subnormals to zero in f32; the subnormal per-element scale collapses so tiny normalized outputs cannot be preserved (odd hidden size)."
164
+ },
165
+ "provenance": {
166
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
167
+ "test": "LayerNormalization",
168
+ "notes": "Odd hidden-size companion for subnormal scale values; this exercises the non-vec4 last-axis path."
169
+ },
170
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
171
+ "inputs": {
172
+ "x": { "dtype": "float32", "shape": [1, 3], "data": { "kind": "values", "values": [-1.0, 0.0, 2.0] } },
173
+ "scale": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1e-40, -2e-40, 3e-40] } }
174
+ },
175
+ "outputs": { "y": { "dtype": "float32", "shape": [1, 3], "tolerance": 1e-44 } }
176
+ },
177
+ {
178
+ "name": "last_axis_y_only",
179
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
180
+ "inputs": {
181
+ "x": {
182
+ "dtype": "float32",
183
+ "shape": [3, 8],
184
+ "data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.29 }
185
+ },
186
+ "scale": {
187
+ "dtype": "float32",
188
+ "shape": [8],
189
+ "data": { "kind": "fillFloat32", "sinStep": 0.31, "cosStep": 0.07, "scale": 0.4 }
190
+ }
191
+ },
192
+ "outputs": { "y": { "dtype": "float32", "shape": [3, 8], "tolerance": 0.000001 } }
193
+ },
194
+ {
195
+ "name": "last_axis_bias_and_stats",
196
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
197
+ "inputs": {
198
+ "x": {
199
+ "dtype": "float32",
200
+ "shape": [2, 3, 7],
201
+ "data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.23 }
202
+ },
203
+ "scale": {
204
+ "dtype": "float32",
205
+ "shape": [7],
206
+ "data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.13, "scale": 0.35 }
207
+ },
208
+ "b": {
209
+ "dtype": "float32",
210
+ "shape": [7],
211
+ "data": { "kind": "fillFloat32", "sinStep": 0.07, "cosStep": 0.17, "scale": 0.2 }
212
+ }
213
+ },
214
+ "outputs": {
215
+ "y": { "dtype": "float32", "shape": [2, 3, 7], "tolerance": 0.00002 },
216
+ "mean": { "dtype": "float32", "shape": [2, 3, 1], "tolerance": 0.000001 },
217
+ "invStdDev": { "dtype": "float32", "shape": [2, 3, 1], "tolerance": 0.001 }
218
+ }
219
+ },
220
+ {
221
+ "name": "f32_tiny_variance_epsilon_zero_gpu_gap",
222
+ "skipGpu": {
223
+ "category": "permanent",
224
+ "reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal values required by this fixture. Backend evidence: WebGPU/Metal flushes subnormals to zero in f32; the subnormal variance collapses to zero so inverseSqrt produces Infinity instead of a finite large InvStdDev."
225
+ },
226
+ "provenance": {
227
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
228
+ "test": "LayerNormTest.LayerNorm17_opset",
229
+ "notes": "Valid epsilon=0 edge: normal inputs produce subnormal variance but finite order-one normalized outputs and finite large InvStdDev."
230
+ },
231
+ "attrs": { "epsilon": 0, "axis": -1 },
232
+ "inputs": {
233
+ "x": {
234
+ "dtype": "float32",
235
+ "shape": [2, 2],
236
+ "data": { "kind": "values", "values": [1e-20, -1e-20, 2e-20, -2e-20] }
237
+ },
238
+ "scale": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, 1.0] } },
239
+ "b": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 0.0] } }
240
+ },
241
+ "outputs": {
242
+ "y": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.00001 },
243
+ "mean": { "dtype": "float32", "shape": [2, 1], "tolerance": 0 },
244
+ "invStdDev": { "dtype": "float32", "shape": [2, 1], "tolerance": 1000000000000000, "relTolerance": 0.00001 }
245
+ }
246
+ },
247
+ {
248
+ "name": "last_axis_mean_only_no_bias",
249
+ "provenance": {
250
+ "source": "ONNX LayerNormalization-17 optional-output contract",
251
+ "notes": "Requests Mean while independently omitting both B and InvStdDev."
252
+ },
253
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
254
+ "inputs": {
255
+ "x": {
256
+ "dtype": "float32",
257
+ "shape": [2, 4],
258
+ "data": { "kind": "values", "values": [1.5, -2.0, 0.25, 4.0, 10.0, 10.5, 9.75, 10.25] }
259
+ },
260
+ "scale": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, -0.5, 2.0, 0.25] } }
261
+ },
262
+ "outputs": {
263
+ "y": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000002 },
264
+ "mean": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 }
265
+ }
266
+ },
267
+ {
268
+ "name": "suffix_axis_inv_std_dev_only_no_bias",
269
+ "provenance": {
270
+ "source": "ONNX LayerNormalization-17 optional-output contract",
271
+ "notes": "Requests InvStdDev while independently omitting the earlier optional Mean output and B."
272
+ },
273
+ "attrs": { "epsilon": 0.00001, "axis": 1 },
274
+ "inputs": {
275
+ "x": {
276
+ "dtype": "float32",
277
+ "shape": [2, 2, 3],
278
+ "data": { "kind": "values", "values": [-3.0, -1.0, 2.0, 4.0, 5.0, 8.0, 10.0, 8.0, 7.0, 3.0, 1.0, -2.0] }
279
+ },
280
+ "scale": {
281
+ "dtype": "float32",
282
+ "shape": [2, 3],
283
+ "data": { "kind": "values", "values": [1.0, 0.5, -1.0, 2.0, -0.25, 0.75] }
284
+ }
285
+ },
286
+ "outputs": {
287
+ "y": { "dtype": "float32", "shape": [2, 2, 3], "tolerance": 0.000002 },
288
+ "invStdDev": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.000001 }
289
+ }
290
+ },
291
+ {
292
+ "name": "suffix_axis_bias_inv_std_dev_only",
293
+ "provenance": {
294
+ "source": "ONNX LayerNormalization-17 optional-output contract",
295
+ "notes": "Requests B and InvStdDev while independently omitting the earlier optional Mean output."
296
+ },
297
+ "attrs": { "epsilon": 0.00001, "axis": 1 },
298
+ "inputs": {
299
+ "x": {
300
+ "dtype": "float32",
301
+ "shape": [2, 2, 3],
302
+ "data": { "kind": "values", "values": [-2.0, 0.0, 1.0, 3.0, 7.0, 9.0, 12.0, 9.0, 6.0, 4.0, 2.0, -1.0] }
303
+ },
304
+ "scale": {
305
+ "dtype": "float32",
306
+ "shape": [2, 3],
307
+ "data": { "kind": "values", "values": [0.5, -1.0, 1.5, 0.25, 2.0, -0.75] }
308
+ },
309
+ "b": {
310
+ "dtype": "float32",
311
+ "shape": [2, 3],
312
+ "data": { "kind": "values", "values": [0.1, -0.2, 0.3, -0.4, 0.5, -0.6] }
313
+ }
314
+ },
315
+ "outputs": {
316
+ "y": { "dtype": "float32", "shape": [2, 2, 3], "tolerance": 0.000002 },
317
+ "invStdDev": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.000001 }
318
+ }
319
+ },
320
+ {
321
+ "name": "last_axis_mean_only_output",
322
+ "provenance": {
323
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_default_axis",
324
+ "notes": "ONNX optional outputs may be requested as a prefix; this asks for Y and Mean without InvStdDev."
325
+ },
326
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
327
+ "inputs": {
328
+ "x": {
329
+ "dtype": "float32",
330
+ "shape": [2, 4],
331
+ "data": { "kind": "values", "values": [1.5, -2.0, 0.25, 4.0, 10.0, 10.5, 9.75, 10.25] }
332
+ },
333
+ "scale": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, -0.5, 2.0, 0.25] } },
334
+ "b": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [0.0, 0.1, -0.2, 0.5] } }
335
+ },
336
+ "outputs": {
337
+ "y": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000002 },
338
+ "mean": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 }
339
+ }
340
+ },
341
+ {
342
+ "name": "large_values_centered_variance_regression",
343
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
344
+ "provenance": {
345
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
346
+ "test": "LayerNormTest.LayerNorm_LargeValues_NoNaN"
347
+ },
348
+ "inputs": {
349
+ "x": {
350
+ "dtype": "float32",
351
+ "shape": [1, 4],
352
+ "data": { "kind": "values", "values": [40000.0, 40001.0, 40002.0, 40003.0] }
353
+ },
354
+ "scale": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0] } },
355
+ "b": { "dtype": "float32", "shape": [4], "data": { "kind": "constant", "value": 0.0 } }
356
+ },
357
+ "outputs": {
358
+ "y": {
359
+ "dtype": "float32",
360
+ "shape": [1, 4],
361
+ "tolerance": 0.00001,
362
+ "data": {
363
+ "kind": "values",
364
+ "values": [-1.3416354656219482, -0.4472118020057678, 0.4472118020057678, 1.3416354656219482]
365
+ }
366
+ },
367
+ "mean": {
368
+ "dtype": "float32",
369
+ "shape": [1, 1],
370
+ "tolerance": 0.0001,
371
+ "data": { "kind": "values", "values": [40001.5] }
372
+ },
373
+ "invStdDev": {
374
+ "dtype": "float32",
375
+ "shape": [1, 1],
376
+ "tolerance": 0.00001,
377
+ "data": { "kind": "values", "values": [0.8944236040115356] }
378
+ }
379
+ }
380
+ },
381
+ {
382
+ "name": "ort_very_large_values_no_nan",
383
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
384
+ "provenance": {
385
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
386
+ "test": "LayerNormTest.LayerNorm_VeryLargeValues_NoNaN"
387
+ },
388
+ "inputs": {
389
+ "x": {
390
+ "dtype": "float32",
391
+ "shape": [1, 4],
392
+ "data": { "kind": "values", "values": [80000.0, 80001.0, 80002.0, 80003.0] }
393
+ },
394
+ "scale": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0] } },
395
+ "b": { "dtype": "float32", "shape": [4], "data": { "kind": "constant", "value": 0.0 } }
396
+ },
397
+ "outputs": {
398
+ "y": {
399
+ "dtype": "float32",
400
+ "shape": [1, 4],
401
+ "tolerance": 0.00001,
402
+ "data": {
403
+ "kind": "values",
404
+ "values": [-1.3416354656219482, -0.4472118020057678, 0.4472118020057678, 1.3416354656219482]
405
+ }
406
+ },
407
+ "mean": {
408
+ "dtype": "float32",
409
+ "shape": [1, 1],
410
+ "tolerance": 0.0001,
411
+ "data": { "kind": "values", "values": [80001.5] }
412
+ },
413
+ "invStdDev": {
414
+ "dtype": "float32",
415
+ "shape": [1, 1],
416
+ "tolerance": 0.00001,
417
+ "data": { "kind": "values", "values": [0.8944236040115356] }
418
+ }
419
+ }
420
+ },
421
+ {
422
+ "name": "zero_variance_bias",
423
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
424
+ "inputs": {
425
+ "x": { "dtype": "float32", "shape": [2, 4], "data": { "kind": "constant", "value": 5.0 } },
426
+ "scale": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } },
427
+ "b": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [0.5, -0.25, 1.0, 2.0] } }
428
+ },
429
+ "outputs": { "y": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000001 } }
430
+ },
431
+ {
432
+ "name": "ort_constant_weights_large_input",
433
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
434
+ "provenance": {
435
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
436
+ "test": "LayerNormTest.LayerNorm_ConstantWeights_LargeInput"
437
+ },
438
+ "inputs": {
439
+ "x": {
440
+ "dtype": "float32",
441
+ "shape": [1, 4],
442
+ "data": { "kind": "values", "values": [2396.814, 2396.814, 2396.814, 2396.814] }
443
+ },
444
+ "scale": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [0.1, 0.1, 0.1, 0.1] } },
445
+ "b": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [0.1, 0.1, 0.1, 0.1] } }
446
+ },
447
+ "outputs": {
448
+ "y": {
449
+ "dtype": "float32",
450
+ "shape": [1, 4],
451
+ "tolerance": 0.000001,
452
+ "data": { "kind": "values", "values": [0.1, 0.1, 0.1, 0.1] }
453
+ }
454
+ }
455
+ },
456
+ {
457
+ "name": "ort_norm_size1_no_bias_stats",
458
+ "attrs": { "epsilon": 0.00001, "axis": 2 },
459
+ "provenance": {
460
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
461
+ "test": "LayerNormTest.LayerNorm_NormSize1_NoBias"
462
+ },
463
+ "inputs": {
464
+ "x": {
465
+ "dtype": "float32",
466
+ "shape": [2, 3, 1],
467
+ "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
468
+ },
469
+ "scale": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [1.0] } }
470
+ },
471
+ "outputs": {
472
+ "y": {
473
+ "dtype": "float32",
474
+ "shape": [2, 3, 1],
475
+ "tolerance": 0.000001,
476
+ "data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }
477
+ },
478
+ "mean": {
479
+ "dtype": "float32",
480
+ "shape": [2, 3, 1],
481
+ "tolerance": 0.000001,
482
+ "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
483
+ },
484
+ "invStdDev": {
485
+ "dtype": "float32",
486
+ "shape": [2, 3, 1],
487
+ "tolerance": 0.001,
488
+ "data": {
489
+ "kind": "values",
490
+ "values": [316.2277526855469, 316.2277526855469, 316.2277526855469, 316.2277526855469, 316.2277526855469, 316.2277526855469]
491
+ }
492
+ }
493
+ }
494
+ },
495
+ {
496
+ "name": "zero_rows_noop",
497
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
498
+ "inputs": {
499
+ "x": { "dtype": "float32", "shape": [0, 4], "data": { "kind": "values", "values": [] } },
500
+ "scale": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0] } }
501
+ },
502
+ "outputs": { "y": { "dtype": "float32", "shape": [0, 4], "tolerance": 0.000001 } }
503
+ },
504
+ {
505
+ "name": "axis1_rank3_scale_matrix",
506
+ "attrs": { "epsilon": 0.00001, "axis": 1 },
507
+ "inputs": {
508
+ "x": {
509
+ "dtype": "float32",
510
+ "shape": [2, 3, 4],
511
+ "data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.23 }
512
+ },
513
+ "scale": {
514
+ "dtype": "float32",
515
+ "shape": [3, 4],
516
+ "data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.13, "scale": 0.35 }
517
+ }
518
+ },
519
+ "outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4], "tolerance": 0.000001 } }
520
+ },
521
+ {
522
+ "name": "axis1_rank3_scale_matrix_stats",
523
+ "attrs": { "epsilon": 0.00001, "axis": 1 },
524
+ "inputs": {
525
+ "x": {
526
+ "dtype": "float32",
527
+ "shape": [2, 3, 4],
528
+ "data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.25 }
529
+ },
530
+ "scale": {
531
+ "dtype": "float32",
532
+ "shape": [3, 4],
533
+ "data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.09, "scale": 0.3 }
534
+ }
535
+ },
536
+ "outputs": {
537
+ "y": { "dtype": "float32", "shape": [2, 3, 4], "tolerance": 0.000001 },
538
+ "mean": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.000001 },
539
+ "invStdDev": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.00001 }
540
+ }
541
+ },
542
+ {
543
+ "name": "axis1_rank3_scale_bias_matrix",
544
+ "attrs": { "epsilon": 0.00001, "axis": 1 },
545
+ "inputs": {
546
+ "x": {
547
+ "dtype": "float32",
548
+ "shape": [2, 3, 4],
549
+ "data": { "kind": "fillFloat32", "sinStep": 0.09, "cosStep": 0.21 }
550
+ },
551
+ "scale": {
552
+ "dtype": "float32",
553
+ "shape": [3, 4],
554
+ "data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.15, "scale": 0.25 }
555
+ },
556
+ "b": {
557
+ "dtype": "float32",
558
+ "shape": [3, 4],
559
+ "data": { "kind": "fillFloat32", "sinStep": 0.05, "cosStep": 0.11, "scale": 0.2 }
560
+ }
561
+ },
562
+ "outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4], "tolerance": 0.000001 } }
563
+ },
564
+ {
565
+ "name": "ort_opset17_float16_last_axis_stats",
566
+ "provenance": {
567
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
568
+ "test": "LayerNormTest.LayerNorm17_opset"
569
+ },
570
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
571
+ "inputs": {
572
+ "x": {
573
+ "dtype": "float16",
574
+ "shape": [1, 2, 3],
575
+ "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
576
+ },
577
+ "scale": { "dtype": "float16", "shape": [3], "data": { "kind": "values", "values": [1.0, 1.0, 1.0] } }
578
+ },
579
+ "outputs": {
580
+ "y": { "dtype": "float16", "shape": [1, 2, 3], "tolerance": 0.002 },
581
+ "mean": { "dtype": "float32", "shape": [1, 2, 1], "tolerance": 0.002 },
582
+ "invStdDev": { "dtype": "float32", "shape": [1, 2, 1], "tolerance": 0.01 }
583
+ }
584
+ },
585
+ {
586
+ "name": "ort_negative_suffix_axis_rank3",
587
+ "provenance": {
588
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
589
+ "test": "LayerNormTest.LayerNorm_ValidScaleBias_Broadcast"
590
+ },
591
+ "attrs": { "epsilon": 0.00001, "axis": -2 },
592
+ "inputs": {
593
+ "x": {
594
+ "dtype": "float32",
595
+ "shape": [1, 3, 2],
596
+ "data": { "kind": "values", "values": [1.2416, 0.946123, 13.1685, 0.36423, 21.145, 0.03941] }
597
+ },
598
+ "scale": {
599
+ "dtype": "float32",
600
+ "shape": [3, 2],
601
+ "data": { "kind": "values", "values": [-0.6953, 5.1824, -0.25, 0.75, 1.5, -2.0] }
602
+ },
603
+ "b": {
604
+ "dtype": "float32",
605
+ "shape": [3, 2],
606
+ "data": { "kind": "values", "values": [0.6435, -0.3964, 0.25, -0.75, 1.0, 2.0] }
607
+ }
608
+ },
609
+ "outputs": {
610
+ "y": { "dtype": "float32", "shape": [1, 3, 2], "tolerance": 0.000002 },
611
+ "mean": { "dtype": "float32", "shape": [1, 1, 1], "tolerance": 0.000001 },
612
+ "invStdDev": { "dtype": "float32", "shape": [1, 1, 1], "tolerance": 0.00001 }
613
+ }
614
+ },
615
+ {
616
+ "name": "axis0_scalar_stats_whole_tensor",
617
+ "provenance": {
618
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
619
+ "test": "LayerNormTest.LayerNorm"
620
+ },
621
+ "attrs": { "epsilon": 0.00001, "axis": 0 },
622
+ "inputs": {
623
+ "x": {
624
+ "dtype": "float32",
625
+ "shape": [2, 3],
626
+ "data": { "kind": "values", "values": [10.0, -10.0, 5.0, -5.0, 2.0, -2.0] }
627
+ },
628
+ "scale": {
629
+ "dtype": "float32",
630
+ "shape": [2, 3],
631
+ "data": { "kind": "values", "values": [1.0, 0.5, -1.0, 2.0, -0.25, 1.5] }
632
+ },
633
+ "b": {
634
+ "dtype": "float32",
635
+ "shape": [2, 3],
636
+ "data": { "kind": "values", "values": [0.0, 1.0, -1.0, 0.5, -0.5, 2.0] }
637
+ }
638
+ },
639
+ "outputs": {
640
+ "y": { "dtype": "float32", "shape": [2, 3], "tolerance": 0.000002 },
641
+ "mean": { "dtype": "float32", "shape": [1, 1], "tolerance": 0.000001 },
642
+ "invStdDev": { "dtype": "float32", "shape": [1, 1], "tolerance": 0.00001 }
643
+ }
644
+ },
645
+ {
646
+ "name": "ort_axis2_scalar_scale_no_bias",
647
+ "provenance": {
648
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
649
+ "test": "LayerNormTest.LayerNorm_Scale_Scalar_NoBias_Axis2"
650
+ },
651
+ "attrs": { "epsilon": 0.00001, "axis": 2 },
652
+ "inputs": {
653
+ "x": {
654
+ "dtype": "float32",
655
+ "shape": [2, 2, 2],
656
+ "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
657
+ },
658
+ "scale": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [1.5] } }
659
+ },
660
+ "outputs": { "y": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0.0001 } }
661
+ },
662
+ {
663
+ "name": "ort_axis2_scalar_scale_bias",
664
+ "provenance": {
665
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
666
+ "test": "LayerNormTest.LayerNorm_Scale_Bias_Scalar_Axis2"
667
+ },
668
+ "attrs": { "epsilon": 0.00001, "axis": 2 },
669
+ "inputs": {
670
+ "x": {
671
+ "dtype": "float32",
672
+ "shape": [2, 2, 2],
673
+ "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
674
+ },
675
+ "scale": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [1.5] } },
676
+ "b": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [0.1] } }
677
+ },
678
+ "outputs": { "y": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0.0001 } }
679
+ },
680
+ {
681
+ "name": "ort_broadcast_dim0_scale_bias",
682
+ "provenance": {
683
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
684
+ "test": "LayerNormTest.LayerNorm_Scale_Bias_Broadcast_Dim0"
685
+ },
686
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
687
+ "inputs": {
688
+ "x": {
689
+ "dtype": "float32",
690
+ "shape": [4, 2, 2],
691
+ "data": {
692
+ "kind": "values",
693
+ "values": [-1.0, 2.0, -10.264, 8.6453, 3.0, -4.0, 43.1561, -0.641239, -5.0, 6.0, -8.2164, 0.11412, 7.0, 8.0, 41.3156, 3.0458]
694
+ }
695
+ },
696
+ "scale": {
697
+ "dtype": "float32",
698
+ "shape": [1, 2, 2],
699
+ "data": { "kind": "values", "values": [-0.1, 1.7, -0.6953, 5.1824] }
700
+ },
701
+ "b": { "dtype": "float32", "shape": [1, 2, 2], "data": { "kind": "values", "values": [-2.0, 0.3, 0.0, 0.0] } }
702
+ },
703
+ "outputs": { "y": { "dtype": "float32", "shape": [4, 2, 2], "tolerance": 0.0001 } }
704
+ },
705
+ {
706
+ "name": "ort_broadcast_dim1_scale_bias",
707
+ "provenance": {
708
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
709
+ "test": "LayerNormTest.LayerNorm_Scale_Bias_Broadcast_Dim1"
710
+ },
711
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
712
+ "inputs": {
713
+ "x": {
714
+ "dtype": "float32",
715
+ "shape": [2, 4, 2],
716
+ "data": {
717
+ "kind": "values",
718
+ "values": [-1.0, 2.0, 3.0, -4.0, -5.0, 6.0, 7.0, 8.0, -10.264, 8.6453, 43.1561, -0.641239, -8.2164, 0.11412, 41.3156, 3.0458]
719
+ }
720
+ },
721
+ "scale": {
722
+ "dtype": "float32",
723
+ "shape": [2, 1, 2],
724
+ "data": { "kind": "values", "values": [-0.1, 1.7, -0.6953, 5.1824] }
725
+ },
726
+ "b": { "dtype": "float32", "shape": [2, 1, 2], "data": { "kind": "values", "values": [-2.0, 0.3, 0.0, 0.0] } }
727
+ },
728
+ "outputs": {
729
+ "y": {
730
+ "dtype": "float32",
731
+ "shape": [2, 4, 2],
732
+ "tolerance": 0.0001,
733
+ "data": {
734
+ "kind": "values",
735
+ "values": [-1.9, 2.0, -2.1, -1.4, -1.9, 2.0, -1.9, 2.0, 0.6953, 5.1824, -0.6953, -5.1824, 0.6953, 5.1824, -0.6953, -5.1824]
736
+ }
737
+ }
738
+ }
739
+ },
740
+ {
741
+ "name": "ort_axis1_inner_broadcast_scale",
742
+ "provenance": {
743
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
744
+ "test": "LayerNormTest.LayerNorm_Scale_Broadcast_Inner_Mixed"
745
+ },
746
+ "attrs": { "epsilon": 0.00001, "axis": 1 },
747
+ "inputs": {
748
+ "x": {
749
+ "dtype": "float32",
750
+ "shape": [1, 2, 4],
751
+ "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
752
+ },
753
+ "scale": { "dtype": "float32", "shape": [1, 4], "data": { "kind": "values", "values": [1.0, 0.5, 1.0, 0.5] } }
754
+ },
755
+ "outputs": { "y": { "dtype": "float32", "shape": [1, 2, 4], "tolerance": 0.0001 } }
756
+ },
757
+ {
758
+ "name": "ort_axis1_scale_bias_inner_broadcast",
759
+ "provenance": {
760
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
761
+ "test": "LayerNormTest.LayerNorm_ValidScaleBias_Broadcast"
762
+ },
763
+ "attrs": { "epsilon": 0.00001, "axis": 1 },
764
+ "inputs": {
765
+ "x": {
766
+ "dtype": "float32",
767
+ "shape": [1, 3, 2],
768
+ "data": { "kind": "values", "values": [1.2416, 0.946123, 13.1685, 0.36423, 21.145, 0.03941] }
769
+ },
770
+ "scale": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-0.6953, 5.1824] } },
771
+ "b": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.6435, -0.3964] } }
772
+ },
773
+ "outputs": {
774
+ "y": {
775
+ "dtype": "float32",
776
+ "shape": [1, 3, 2],
777
+ "tolerance": 0.0001,
778
+ "data": { "kind": "values", "values": [1.063606, -3.716114, 0.042961, -4.087264, -0.639629, -4.294445] }
779
+ }
780
+ }
781
+ },
782
+ {
783
+ "name": "ort_axis3_scale_bias_outer_inner_broadcast_4d",
784
+ "provenance": {
785
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
786
+ "test": "LayerNormTest.LayerNorm_Scale_Bias_4D_OuterInnerBroadcast_Axis3"
787
+ },
788
+ "attrs": { "epsilon": 0.00001, "axis": 3 },
789
+ "inputs": {
790
+ "x": {
791
+ "dtype": "float32",
792
+ "shape": [1, 2, 2, 2],
793
+ "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
794
+ },
795
+ "scale": {
796
+ "dtype": "float32",
797
+ "shape": [1, 2, 1, 2],
798
+ "data": { "kind": "values", "values": [1.0, 1.1, 1.2, 1.3] }
799
+ },
800
+ "b": { "dtype": "float32", "shape": [1, 2, 1, 2], "data": { "kind": "values", "values": [0.0, 0.5, 1.0, 1.5] } }
801
+ },
802
+ "outputs": {
803
+ "y": {
804
+ "dtype": "float32",
805
+ "shape": [1, 2, 2, 2],
806
+ "tolerance": 0.0001,
807
+ "data": { "kind": "values", "values": [-1.0, 1.6, -1.0, 1.6, -0.2, 2.8, -0.2, 2.8] }
808
+ }
809
+ }
810
+ },
811
+ {
812
+ "name": "onnx_backend_layer_normalization_2d_axis1",
813
+ "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_2d_axis1" },
814
+ "inputs": {
815
+ "x": {
816
+ "dtype": "float32",
817
+ "shape": [3, 4],
818
+ "data": {
819
+ "kind": "values",
820
+ "values": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322]
821
+ }
822
+ },
823
+ "scale": {
824
+ "dtype": "float32",
825
+ "shape": [4],
826
+ "data": {
827
+ "kind": "values",
828
+ "values": [-0.6724604368209839, -0.35955315828323364, -0.8131462931632996, -1.7262825965881348]
829
+ }
830
+ },
831
+ "b": {
832
+ "dtype": "float32",
833
+ "shape": [4],
834
+ "data": {
835
+ "kind": "values",
836
+ "values": [0.17742614448070526, -0.4017809331417084, -1.630198359489441, 0.46278226375579834]
837
+ }
838
+ }
839
+ },
840
+ "outputs": {
841
+ "y": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.0001 },
842
+ "mean": { "dtype": "float32", "shape": [3, 1], "tolerance": 0.00001 },
843
+ "invStdDev": { "dtype": "float32", "shape": [3, 1], "tolerance": 0.001 }
844
+ },
845
+ "attrs": { "axis": 1 }
846
+ },
847
+ {
848
+ "name": "onnx_backend_layer_normalization_2d_axis_negative_1",
849
+ "provenance": {
850
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_2d_axis_negative_1"
851
+ },
852
+ "inputs": {
853
+ "x": {
854
+ "dtype": "float32",
855
+ "shape": [3, 4],
856
+ "data": {
857
+ "kind": "values",
858
+ "values": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322]
859
+ }
860
+ },
861
+ "scale": {
862
+ "dtype": "float32",
863
+ "shape": [4],
864
+ "data": {
865
+ "kind": "values",
866
+ "values": [-0.9072983860969543, 0.05194539576768875, 0.7290905714035034, 0.12898291647434235]
867
+ }
868
+ },
869
+ "b": {
870
+ "dtype": "float32",
871
+ "shape": [4],
872
+ "data": {
873
+ "kind": "values",
874
+ "values": [1.1394007205963135, -1.234825849533081, 0.4023416340351105, -0.6848101019859314]
875
+ }
876
+ }
877
+ },
878
+ "outputs": {
879
+ "y": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.0001 },
880
+ "mean": { "dtype": "float32", "shape": [3, 1], "tolerance": 0.00001 },
881
+ "invStdDev": { "dtype": "float32", "shape": [3, 1], "tolerance": 0.001 }
882
+ },
883
+ "attrs": { "axis": -1 }
884
+ },
885
+ {
886
+ "name": "onnx_backend_layer_normalization_3d_axis2_epsilon",
887
+ "provenance": {
888
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_3d_axis2_epsilon"
889
+ },
890
+ "inputs": {
891
+ "x": {
892
+ "dtype": "float32",
893
+ "shape": [2, 3, 5],
894
+ "data": {
895
+ "kind": "values",
896
+ "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_3d_input_x" }
897
+ }
898
+ },
899
+ "scale": {
900
+ "dtype": "float32",
901
+ "shape": [5],
902
+ "data": {
903
+ "kind": "values",
904
+ "values": [0.9101788997650146, 0.31721821427345276, 0.7863279581069946, -0.4664191007614136, -0.9444462656974792]
905
+ }
906
+ },
907
+ "b": {
908
+ "dtype": "float32",
909
+ "shape": [5],
910
+ "data": {
911
+ "kind": "values",
912
+ "values": [-0.410049706697464, -0.017020413652062416, 0.37915173172950745, 2.2593090534210205, -0.0422571524977684]
913
+ }
914
+ }
915
+ },
916
+ "outputs": {
917
+ "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.0001 },
918
+ "mean": { "dtype": "float32", "shape": [2, 3, 1], "tolerance": 0.00001 },
919
+ "invStdDev": { "dtype": "float32", "shape": [2, 3, 1], "tolerance": 0.001 }
920
+ },
921
+ "attrs": { "axis": 2, "epsilon": 0.10000000149011612 }
922
+ },
923
+ {
924
+ "name": "onnx_backend_layer_normalization_3d_axis_negative_1_epsilon",
925
+ "provenance": {
926
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_3d_axis_negative_1_epsilon"
927
+ },
928
+ "inputs": {
929
+ "x": {
930
+ "dtype": "float32",
931
+ "shape": [2, 3, 5],
932
+ "data": {
933
+ "kind": "values",
934
+ "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_3d_input_x" }
935
+ }
936
+ },
937
+ "scale": {
938
+ "dtype": "float32",
939
+ "shape": [5],
940
+ "data": {
941
+ "kind": "values",
942
+ "values": [-0.9559450149536133, -0.34598177671432495, -0.463595986366272, 0.4814814627170563, -1.5407969951629639]
943
+ }
944
+ },
945
+ "b": {
946
+ "dtype": "float32",
947
+ "shape": [5],
948
+ "data": {
949
+ "kind": "values",
950
+ "values": [0.06326199322938919, 0.15650653839111328, 0.23218104243278503, -0.5973160862922668, -0.23792172968387604]
951
+ }
952
+ }
953
+ },
954
+ "outputs": {
955
+ "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.0001 },
956
+ "mean": { "dtype": "float32", "shape": [2, 3, 1], "tolerance": 0.00001 },
957
+ "invStdDev": { "dtype": "float32", "shape": [2, 3, 1], "tolerance": 0.001 }
958
+ },
959
+ "attrs": { "axis": -1, "epsilon": 0.10000000149011612 }
960
+ },
961
+ {
962
+ "name": "onnx_backend_layer_normalization_4d_axis3",
963
+ "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_4d_axis3" },
964
+ "inputs": {
965
+ "x": {
966
+ "dtype": "float32",
967
+ "shape": [2, 3, 4, 5],
968
+ "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_input_x" } }
969
+ },
970
+ "scale": {
971
+ "dtype": "float32",
972
+ "shape": [5],
973
+ "data": {
974
+ "kind": "values",
975
+ "values": [-1.2986867427825928, 1.2760753631591797, 1.3250139951705933, 0.20533256232738495, 0.04513401538133621]
976
+ }
977
+ },
978
+ "b": {
979
+ "dtype": "float32",
980
+ "shape": [5],
981
+ "data": {
982
+ "kind": "values",
983
+ "values": [2.3396248817443848, -0.2764328420162201, -0.2595769762992859, 0.36448124051094055, 1.471321940422058]
984
+ }
985
+ }
986
+ },
987
+ "outputs": {
988
+ "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 },
989
+ "mean": { "dtype": "float32", "shape": [2, 3, 4, 1], "tolerance": 0.00001 },
990
+ "invStdDev": { "dtype": "float32", "shape": [2, 3, 4, 1], "tolerance": 0.001 }
991
+ },
992
+ "attrs": { "axis": 3 }
993
+ },
994
+ {
995
+ "name": "onnx_backend_layer_normalization_4d_axis_negative_1",
996
+ "provenance": {
997
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_4d_axis_negative_1"
998
+ },
999
+ "inputs": {
1000
+ "x": {
1001
+ "dtype": "float32",
1002
+ "shape": [2, 3, 4, 5],
1003
+ "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_input_x" } }
1004
+ },
1005
+ "scale": {
1006
+ "dtype": "float32",
1007
+ "shape": [5],
1008
+ "data": {
1009
+ "kind": "values",
1010
+ "values": [1.5927706956863403, -0.25857263803482056, 0.3083312511444092, -1.3780834674835205, -0.3119761049747467]
1011
+ }
1012
+ },
1013
+ "b": {
1014
+ "dtype": "float32",
1015
+ "shape": [5],
1016
+ "data": {
1017
+ "kind": "values",
1018
+ "values": [-0.840290367603302, -1.0068317651748657, 1.6815767288208008, -0.7922866344451904, -0.5316058993339539]
1019
+ }
1020
+ }
1021
+ },
1022
+ "outputs": {
1023
+ "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 },
1024
+ "mean": { "dtype": "float32", "shape": [2, 3, 4, 1], "tolerance": 0.00001 },
1025
+ "invStdDev": { "dtype": "float32", "shape": [2, 3, 4, 1], "tolerance": 0.001 }
1026
+ },
1027
+ "attrs": { "axis": -1 }
1028
+ },
1029
+ {
1030
+ "name": "onnx_backend_layer_normalization_default_axis",
1031
+ "provenance": {
1032
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_default_axis"
1033
+ },
1034
+ "inputs": {
1035
+ "x": {
1036
+ "dtype": "float32",
1037
+ "shape": [2, 3, 4, 5],
1038
+ "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_input_x" } }
1039
+ },
1040
+ "scale": {
1041
+ "dtype": "float32",
1042
+ "shape": [5],
1043
+ "data": {
1044
+ "kind": "values",
1045
+ "values": [0.37642553448677063, -1.0994007587432861, 0.29823818802833557, 1.3263858556747437, -0.694567859172821]
1046
+ }
1047
+ },
1048
+ "b": {
1049
+ "dtype": "float32",
1050
+ "shape": [5],
1051
+ "data": {
1052
+ "kind": "values",
1053
+ "values": [-0.14963454008102417, -0.4351535439491272, 1.8492637872695923, 0.6722947359085083, 0.40746182203292847]
1054
+ }
1055
+ }
1056
+ },
1057
+ "outputs": {
1058
+ "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 },
1059
+ "mean": { "dtype": "float32", "shape": [2, 3, 4, 1], "tolerance": 0.00001 },
1060
+ "invStdDev": { "dtype": "float32", "shape": [2, 3, 4, 1], "tolerance": 0.001 }
1061
+ }
1062
+ },
1063
+ {
1064
+ "name": "onnx_backend_layer_normalization_2d_axis0",
1065
+ "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_2d_axis0" },
1066
+ "attrs": { "axis": 0, "epsilon": 0.00001 },
1067
+ "inputs": {
1068
+ "x": {
1069
+ "dtype": "float32",
1070
+ "shape": [3, 4],
1071
+ "data": {
1072
+ "kind": "values",
1073
+ "values": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322]
1074
+ }
1075
+ },
1076
+ "scale": {
1077
+ "dtype": "float32",
1078
+ "shape": [3, 4],
1079
+ "data": {
1080
+ "kind": "values",
1081
+ "values": [0.7610377073287964, 0.12167501449584961, 0.44386324286460876, 0.3336743414402008, 1.4940791130065918, -0.2051582634449005, 0.3130677044391632, -0.8540957570075989, -2.5529897212982178, 0.653618574142456, 0.8644362092018127, -0.7421650290489197]
1082
+ }
1083
+ },
1084
+ "b": {
1085
+ "dtype": "float32",
1086
+ "shape": [3, 4],
1087
+ "data": {
1088
+ "kind": "values",
1089
+ "values": [2.269754648208618, -1.4543657302856445, 0.04575851559638977, -0.18718385696411133, 1.5327792167663574, 1.4693588018417358, 0.154947429895401, 0.37816253304481506, -0.8877857327461243, -1.980796456336975, -0.34791216254234314, 0.15634897351264954]
1090
+ }
1091
+ }
1092
+ },
1093
+ "outputs": {
1094
+ "y": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.00005 },
1095
+ "mean": { "dtype": "float32", "shape": [1, 1], "tolerance": 0.00002 },
1096
+ "invStdDev": { "dtype": "float32", "shape": [1, 1], "tolerance": 0.0005 }
1097
+ }
1098
+ },
1099
+ {
1100
+ "name": "onnx_backend_layer_normalization_2d_axis_negative_2",
1101
+ "provenance": {
1102
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_2d_axis_negative_2"
1103
+ },
1104
+ "attrs": { "axis": -2, "epsilon": 0.00001 },
1105
+ "inputs": {
1106
+ "x": {
1107
+ "dtype": "float32",
1108
+ "shape": [3, 4],
1109
+ "data": {
1110
+ "kind": "values",
1111
+ "values": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322]
1112
+ }
1113
+ },
1114
+ "scale": {
1115
+ "dtype": "float32",
1116
+ "shape": [3, 4],
1117
+ "data": {
1118
+ "kind": "values",
1119
+ "values": [1.2302906513214111, 1.202379822731018, -0.38732680678367615, -0.302302747964859, -1.0485529899597168, -1.420017957687378, -1.7062702178955078, 1.950775384902954, -0.5096521973609924, -0.4380742907524109, -1.2527953386306763, 0.7774903774261475]
1120
+ }
1121
+ },
1122
+ "b": {
1123
+ "dtype": "float32",
1124
+ "shape": [3, 4],
1125
+ "data": {
1126
+ "kind": "values",
1127
+ "values": [-1.6138978004455566, -0.21274028718471527, -0.8954665660858154, 0.38690251111984253, -0.5108051300048828, -1.18063223361969, -0.02818222902715206, 0.4283318817615509, 0.06651721894741058, 0.30247190594673157, -0.6343221068382263, -0.3627411723136902]
1128
+ }
1129
+ }
1130
+ },
1131
+ "outputs": {
1132
+ "y": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.00005 },
1133
+ "mean": { "dtype": "float32", "shape": [1, 1], "tolerance": 0.00002 },
1134
+ "invStdDev": { "dtype": "float32", "shape": [1, 1], "tolerance": 0.0005 }
1135
+ }
1136
+ },
1137
+ {
1138
+ "name": "onnx_backend_layer_normalization_3d_axis0_epsilon",
1139
+ "provenance": {
1140
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_3d_axis0_epsilon"
1141
+ },
1142
+ "attrs": { "axis": 0, "epsilon": 0.10000000149011612 },
1143
+ "inputs": {
1144
+ "x": {
1145
+ "dtype": "float32",
1146
+ "shape": [2, 3, 5],
1147
+ "data": {
1148
+ "kind": "values",
1149
+ "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_3d_input_x" }
1150
+ }
1151
+ },
1152
+ "scale": {
1153
+ "dtype": "float32",
1154
+ "shape": [2, 3, 5],
1155
+ "data": {
1156
+ "kind": "values",
1157
+ "values": [0.154947429895401, 0.37816253304481506, -0.8877857327461243, -1.980796456336975, -0.34791216254234314, 0.15634897351264954, 1.2302906513214111, 1.202379822731018, -0.38732680678367615, -0.302302747964859, -1.0485529899597168, -1.420017957687378, -1.7062702178955078, 1.950775384902954, -0.5096521973609924, -0.4380742907524109, -1.2527953386306763, 0.7774903774261475, -1.6138978004455566, -0.21274028718471527, -0.8954665660858154, 0.38690251111984253, -0.5108051300048828, -1.18063223361969, -0.02818222902715206, 0.4283318817615509, 0.06651721894741058, 0.30247190594673157, -0.6343221068382263, -0.3627411723136902]
1158
+ }
1159
+ },
1160
+ "b": {
1161
+ "dtype": "float32",
1162
+ "shape": [2, 3, 5],
1163
+ "data": {
1164
+ "kind": "values",
1165
+ "values": [-0.6724604368209839, -0.35955315828323364, -0.8131462931632996, -1.7262825965881348, 0.17742614448070526, -0.4017809331417084, -1.630198359489441, 0.46278226375579834, -0.9072983860969543, 0.05194539576768875, 0.7290905714035034, 0.12898291647434235, 1.1394007205963135, -1.234825849533081, 0.4023416340351105, -0.6848101019859314, -0.8707971572875977, -0.5788496732711792, -0.3115525245666504, 0.056165341287851334, -1.1651498079299927, 0.9008265137672424, 0.4656624495983124, -1.5362436771392822, 1.4882521629333496, 1.895889163017273, 1.1787796020507812, -0.1799248307943344, -1.0707526206970215, 1.0544517040252686]
1166
+ }
1167
+ }
1168
+ },
1169
+ "outputs": {
1170
+ "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.00005 },
1171
+ "mean": { "dtype": "float32", "shape": [1, 1, 1], "tolerance": 0.00002 },
1172
+ "invStdDev": { "dtype": "float32", "shape": [1, 1, 1], "tolerance": 0.0005 }
1173
+ }
1174
+ },
1175
+ {
1176
+ "name": "onnx_backend_layer_normalization_3d_axis1_epsilon",
1177
+ "provenance": {
1178
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_3d_axis1_epsilon"
1179
+ },
1180
+ "attrs": { "axis": 1, "epsilon": 0.10000000149011612 },
1181
+ "inputs": {
1182
+ "x": {
1183
+ "dtype": "float32",
1184
+ "shape": [2, 3, 5],
1185
+ "data": {
1186
+ "kind": "values",
1187
+ "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_3d_input_x" }
1188
+ }
1189
+ },
1190
+ "scale": {
1191
+ "dtype": "float32",
1192
+ "shape": [3, 5],
1193
+ "data": {
1194
+ "kind": "values",
1195
+ "values": [-0.06824160367250443, 1.7133426666259766, -0.7447548508644104, -0.8264385461807251, -0.09845252335071564, -0.6634783148765564, 1.1266359090805054, -1.0799314975738525, -1.1474686861038208, -0.43782004714012146, -0.49803245067596436, 1.9295320510864258, 0.9494208097457886, 0.08755124360322952, -1.225435495376587]
1196
+ }
1197
+ },
1198
+ "b": {
1199
+ "dtype": "float32",
1200
+ "shape": [3, 5],
1201
+ "data": {
1202
+ "kind": "values",
1203
+ "values": [0.8443629741668701, -1.0002152919769287, -1.5447710752487183, 1.1880297660827637, 0.31694260239601135, 0.9208588004112244, 0.31872764229774475, 0.8568305969238281, -0.6510255932807922, -1.034242868423462, 0.6815944910049438, -0.8034096360206604, -0.6895498037338257, -0.4555324912071228, 0.01747915893793106]
1204
+ }
1205
+ }
1206
+ },
1207
+ "outputs": {
1208
+ "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.00005 },
1209
+ "mean": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.00002 },
1210
+ "invStdDev": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.0005 }
1211
+ }
1212
+ },
1213
+ {
1214
+ "name": "onnx_backend_layer_normalization_3d_axis_negative_2_epsilon",
1215
+ "provenance": {
1216
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_3d_axis_negative_2_epsilon"
1217
+ },
1218
+ "attrs": { "axis": -2, "epsilon": 0.10000000149011612 },
1219
+ "inputs": {
1220
+ "x": {
1221
+ "dtype": "float32",
1222
+ "shape": [2, 3, 5],
1223
+ "data": {
1224
+ "kind": "values",
1225
+ "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_3d_input_x" }
1226
+ }
1227
+ },
1228
+ "scale": {
1229
+ "dtype": "float32",
1230
+ "shape": [3, 5],
1231
+ "data": {
1232
+ "kind": "values",
1233
+ "values": [-0.3539939224720001, -1.3749512434005737, -0.6436184048652649, -2.223403215408325, 0.6252314448356628, -1.602057695388794, -1.1043833494186401, 0.05216507986187935, -0.73956298828125, 1.543014645576477, -1.2928569316864014, 0.2670508623123169, -0.039282817393541336, -1.1680934429168701, 0.523276686668396]
1234
+ }
1235
+ },
1236
+ "b": {
1237
+ "dtype": "float32",
1238
+ "shape": [3, 5],
1239
+ "data": {
1240
+ "kind": "values",
1241
+ "values": [-0.1715463250875473, 0.7717905640602112, 0.8235041499137878, 2.163235902786255, 1.336527943611145, -0.3691818416118622, -0.2393791824579239, 1.0996595621109009, 0.6552637219429016, 0.6401315331459045, -1.6169559955596924, -0.024326125159859657, -0.7380309104919434, 0.279924601316452, -0.09815038740634918]
1242
+ }
1243
+ }
1244
+ },
1245
+ "outputs": {
1246
+ "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.00005 },
1247
+ "mean": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.00002 },
1248
+ "invStdDev": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.0005 }
1249
+ }
1250
+ },
1251
+ {
1252
+ "name": "onnx_backend_layer_normalization_3d_axis_negative_3_epsilon",
1253
+ "provenance": {
1254
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_3d_axis_negative_3_epsilon"
1255
+ },
1256
+ "attrs": { "axis": -3, "epsilon": 0.10000000149011612 },
1257
+ "inputs": {
1258
+ "x": {
1259
+ "dtype": "float32",
1260
+ "shape": [2, 3, 5],
1261
+ "data": {
1262
+ "kind": "values",
1263
+ "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_3d_input_x" }
1264
+ }
1265
+ },
1266
+ "scale": {
1267
+ "dtype": "float32",
1268
+ "shape": [2, 3, 5],
1269
+ "data": {
1270
+ "kind": "values",
1271
+ "values": [-0.4031769335269928, 1.222445011138916, 0.2082749754190445, 0.9766390323638916, 0.3563663959503174, 0.7065731883049011, 0.01050002034753561, 1.7858705520629883, 0.12691208720207214, 0.4019893705844879, 1.8831506967544556, -1.3477590084075928, -1.2704850435256958, 0.969396710395813, -1.1731233596801758, 1.9436211585998535, -0.4136189818382263, -0.747454822063446, 1.922942042350769, 1.4805147647857666, 1.8675589561462402, 0.9060446619987488, -0.8612256646156311, 1.910064935684204, -0.26800337433815, 0.8024563789367676, 0.9472519755363464, -0.15501008927822113, 0.6140793561935425, 0.922206699848175]
1272
+ }
1273
+ },
1274
+ "b": {
1275
+ "dtype": "float32",
1276
+ "shape": [2, 3, 5],
1277
+ "data": {
1278
+ "kind": "values",
1279
+ "values": [0.37642553448677063, -1.0994007587432861, 0.29823818802833557, 1.3263858556747437, -0.694567859172821, -0.14963454008102417, -0.4351535439491272, 1.8492637872695923, 0.6722947359085083, 0.40746182203292847, -0.7699160575866699, 0.5392491817474365, -0.6743326783180237, 0.0318305566906929, -0.6358460783958435, 0.676433265209198, 0.5765908360481262, -0.20829875767230988, 0.39600670337677, -1.0930615663528442, -1.4912575483322144, 0.43939170241355896, 0.16667349636554718, 0.6350314617156982, 2.3831448554992676, 0.9444794654846191, -0.9128222465515137, 1.117016315460205, -1.31590735912323, -0.46158459782600403]
1280
+ }
1281
+ }
1282
+ },
1283
+ "outputs": {
1284
+ "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.00005 },
1285
+ "mean": { "dtype": "float32", "shape": [1, 1, 1], "tolerance": 0.00002 },
1286
+ "invStdDev": { "dtype": "float32", "shape": [1, 1, 1], "tolerance": 0.0005 }
1287
+ }
1288
+ },
1289
+ {
1290
+ "name": "onnx_backend_layer_normalization_4d_axis0",
1291
+ "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_4d_axis0" },
1292
+ "attrs": { "axis": 0, "epsilon": 0.00001 },
1293
+ "inputs": {
1294
+ "x": {
1295
+ "dtype": "float32",
1296
+ "shape": [2, 3, 4, 5],
1297
+ "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_input_x" } }
1298
+ },
1299
+ "scale": {
1300
+ "dtype": "float32",
1301
+ "shape": [2, 3, 4, 5],
1302
+ "data": {
1303
+ "kind": "values",
1304
+ "values": [0.37642553448677063, -1.0994007587432861, 0.29823818802833557, 1.3263858556747437, -0.694567859172821, -0.14963454008102417, -0.4351535439491272, 1.8492637872695923, 0.6722947359085083, 0.40746182203292847, -0.7699160575866699, 0.5392491817474365, -0.6743326783180237, 0.0318305566906929, -0.6358460783958435, 0.676433265209198, 0.5765908360481262, -0.20829875767230988, 0.39600670337677, -1.0930615663528442, -1.4912575483322144, 0.43939170241355896, 0.16667349636554718, 0.6350314617156982, 2.3831448554992676, 0.9444794654846191, -0.9128222465515137, 1.117016315460205, -1.31590735912323, -0.46158459782600403, -0.06824160367250443, 1.7133426666259766, -0.7447548508644104, -0.8264385461807251, -0.09845252335071564, -0.6634783148765564, 1.1266359090805054, -1.0799314975738525, -1.1474686861038208, -0.43782004714012146, -0.49803245067596436, 1.9295320510864258, 0.9494208097457886, 0.08755124360322952, -1.225435495376587, 0.8443629741668701, -1.0002152919769287, -1.5447710752487183, 1.1880297660827637, 0.31694260239601135, 0.9208588004112244, 0.31872764229774475, 0.8568305969238281, -0.6510255932807922, -1.034242868423462, 0.6815944910049438, -0.8034096360206604, -0.6895498037338257, -0.4555324912071228, 0.01747915893793106, -0.3539939224720001, -1.3749512434005737, -0.6436184048652649, -2.223403215408325, 0.6252314448356628, -1.602057695388794, -1.1043833494186401, 0.05216507986187935, -0.73956298828125, 1.543014645576477, -1.2928569316864014, 0.2670508623123169, -0.039282817393541336, -1.1680934429168701, 0.523276686668396, -0.1715463250875473, 0.7717905640602112, 0.8235041499137878, 2.163235902786255, 1.336527943611145, -0.3691818416118622, -0.2393791824579239, 1.0996595621109009, 0.6552637219429016, 0.6401315331459045, -1.6169559955596924, -0.024326125159859657, -0.7380309104919434, 0.279924601316452, -0.09815038740634918, 0.9101788997650146, 0.31721821427345276, 0.7863279581069946, -0.4664191007614136, -0.9444462656974792, -0.410049706697464, -0.017020413652062416, 0.37915173172950745, 2.2593090534210205, -0.0422571524977684, -0.9559450149536133, -0.34598177671432495, -0.463595986366272, 0.4814814627170563, -1.5407969951629639, 0.06326199322938919, 0.15650653839111328, 0.23218104243278503, -0.5973160862922668, -0.23792172968387604, -1.4240609407424927, -0.49331986904144287, -0.5428614616394043, 0.4160500466823578, -1.1561824083328247, 0.7811980843544006, 1.494484543800354, -2.0699849128723145, 0.42625874280929565, 0.676908016204834]
1305
+ }
1306
+ },
1307
+ "b": {
1308
+ "dtype": "float32",
1309
+ "shape": [2, 3, 4, 5],
1310
+ "data": {
1311
+ "kind": "values",
1312
+ "values": [-0.6374370455741882, -0.3972718119621277, -0.1328805834054947, -0.29779088497161865, -0.3090129792690277, -1.6760038137435913, 1.1523315906524658, 1.0796185731887817, -0.8133642673492432, -1.4664243459701538, 0.5210648775100708, -0.5757879614830017, 0.14195317029953003, -0.3193284273147583, 0.6915387511253357, 0.694749116897583, -0.7255973815917969, -1.383363962173462, -1.5829384326934814, 0.6103793978691101, -1.188859224319458, -0.5068163275718689, -0.596314013004303, -0.05256729573011398, -1.9362797737121582, 0.1887785941362381, 0.523891031742096, 0.08842208981513977, -0.3108861744403839, 0.09740016609430313, 0.3990463316440582, -2.772592782974243, 1.9559123516082764, 0.3900933265686035, -0.6524085998535156, -0.3909533619880676, 0.4937417805194855, -0.11610393971204758, -2.030684471130371, 2.06449294090271, -0.11054065823554993, 1.0201727151870728, -0.6920498609542847, 1.5363770723342896, 0.28634369373321533, 0.6088438630104065, -1.0452533960342407, 1.211145281791687, 0.6898181438446045, 1.3018462657928467, -0.62808758020401, -0.48102712631225586, 2.3039166927337646, -1.0600157976150513, -0.13594970107078552, 1.1368913650512695, 0.09772496670484543, 0.582953691482544, -0.39944902062416077, 0.3700558841228485, -1.3065268993377686, 1.6581306457519531, -0.1181640475988388, -0.6801782250404358, 0.6663830876350403, -0.4607197940349579, -1.3342584371566772, -1.3467174768447876, 0.6937731504440308, -0.15957343578338623, -0.13370156288146973, 1.0777437686920166, -1.1268258094787598, -0.7306777238845825, -0.38487979769706726, 0.09435158967971802, -0.042171452194452286, -0.28688719868659973, -0.06162640079855919, -0.10730527341365814, -0.7196043729782104, -0.8129929900169373, 0.27451634407043457, -0.8909150958061218, -1.1573553085327148, -0.3122922480106354, -0.15766701102256775, 2.256723403930664, -0.7047002911567688, 0.9432607293128967, 0.7471883296966553, -1.188944935798645, 0.7732529640197754, -1.1838806867599487, -2.659172296524048, 0.6063195466995239, -1.7558906078338623, 0.4509344696998596, -0.684010922908783, 1.6595507860183716, 1.0685093402862549, -0.4533858001232147, -0.6878376007080078, -1.214077353477478, -0.4409226179122925, -0.2803554832935333, -0.3646935522556305, 0.1567038595676422, 0.5785214900970459, 0.3496544659137726, -0.7641439437866211, -1.4377914667129517, 1.3645318746566772, -0.6894491910934448, -0.6522936224937439, -0.5211893320083618, -1.8430695533752441, -0.477973997592926, -0.47965580224990845, 0.6203582882881165]
1313
+ }
1314
+ }
1315
+ },
1316
+ "outputs": {
1317
+ "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.00005 },
1318
+ "mean": { "dtype": "float32", "shape": [1, 1, 1, 1], "tolerance": 0.00002 },
1319
+ "invStdDev": { "dtype": "float32", "shape": [1, 1, 1, 1], "tolerance": 0.0005 }
1320
+ }
1321
+ },
1322
+ {
1323
+ "name": "onnx_backend_layer_normalization_4d_axis1",
1324
+ "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_4d_axis1" },
1325
+ "attrs": { "axis": 1, "epsilon": 0.00001 },
1326
+ "inputs": {
1327
+ "x": {
1328
+ "dtype": "float32",
1329
+ "shape": [2, 3, 4, 5],
1330
+ "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_input_x" } }
1331
+ },
1332
+ "scale": {
1333
+ "dtype": "float32",
1334
+ "shape": [3, 4, 5],
1335
+ "data": {
1336
+ "kind": "values",
1337
+ "values": [-1.550429344177246, 0.41731882095336914, -0.9443684816360474, 0.23810315132141113, -1.4059629440307617, -0.5900576710700989, -0.11048940569162369, -1.6606998443603516, 0.11514787375926971, -0.37914755940437317, -1.7423561811447144, -1.303242802619934, 0.605120062828064, 0.8955559730529785, -0.13190864026546478, 0.40476182103157043, 0.2238435596227646, 0.3296229839324951, 1.2859840393066406, -1.5069984197616577, 0.6764607429504395, -0.38200896978378296, -0.2242589294910431, -0.3022497296333313, -0.37514710426330566, -1.2261961698532104, 0.1833391934633255, 1.670943021774292, -0.05613302066922188, -0.0013850427931174636, -0.6872990131378174, -0.11747454851865768, 0.4661664366722107, -0.3702424466609955, -0.45380404591560364, 0.4032645523548126, -0.9180047512054443, 0.2524966299533844, 0.820321798324585, 1.3599485158920288, -0.09038200974464417, 1.367597222328186, 1.0344098806381226, -0.9962126612663269, -1.2179385423660278, -0.3049636483192444, 1.0289355516433716, -0.07228700816631317, -0.60065758228302, 1.5522432327270508, 0.2869044840335846, -2.320594310760498, 0.31716063618659973, 0.5200406312942505, 0.22560866177082062, 0.4497120976448059, -0.06727560609579086, -1.3183958530426025, -0.3707039952278137, -0.9456157684326172]
1338
+ }
1339
+ },
1340
+ "b": {
1341
+ "dtype": "float32",
1342
+ "shape": [3, 4, 5],
1343
+ "data": {
1344
+ "kind": "values",
1345
+ "values": [-0.9327409267425537, -1.2630683183670044, 0.45248907804489136, 0.09789614379405975, -0.4481653571128845, -0.6493379473686218, -0.023423105478286743, 1.0791947841644287, -2.004215717315674, 0.3768765330314636, -0.5457119941711426, -1.8845858573913574, -1.9457030296325684, -0.9127835035324097, 0.219509556889534, 0.39306291937828064, -0.9389815926551819, 1.0170209407806396, 1.4229835271835327, 0.39608657360076904, -0.5914026498794556, 1.1244192123413086, 0.7553957104682922, 0.8674074411392212, -0.6564636826515198, -2.834554433822632, 2.116791009902954, -1.610878348350525, -0.03576807305216789, 2.3807454109191895, 0.33057674765586853, 0.9492464661598206, -1.502396583557129, -1.7776669263839722, -0.5327028036117554, 1.090749740600586, -0.34624946117401123, -0.7946363091468811, 0.1979672908782959, 1.081935167312622, -1.444940209388733, -1.2105430364608765, -0.788669228553772, 1.0946383476257324, 0.23482152819633484, 2.1321535110473633, 0.9364457130432129, -0.035095177590847015, 1.265077829360962, 0.2114970088005066, -0.7049213647842407, 0.6799748539924622, -0.6963266730308533, -0.29039710760116577, 1.3277827501296997, -0.10128148645162582, -0.8031414151191711, -0.46433767676353455, 1.021790623664856, -0.55254065990448]
1346
+ }
1347
+ }
1348
+ },
1349
+ "outputs": {
1350
+ "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.00005 },
1351
+ "mean": { "dtype": "float32", "shape": [2, 1, 1, 1], "tolerance": 0.00002 },
1352
+ "invStdDev": { "dtype": "float32", "shape": [2, 1, 1, 1], "tolerance": 0.0005 }
1353
+ }
1354
+ },
1355
+ {
1356
+ "name": "onnx_backend_layer_normalization_4d_axis2",
1357
+ "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_4d_axis2" },
1358
+ "attrs": { "axis": 2, "epsilon": 0.00001 },
1359
+ "inputs": {
1360
+ "x": {
1361
+ "dtype": "float32",
1362
+ "shape": [2, 3, 4, 5],
1363
+ "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_input_x" } }
1364
+ },
1365
+ "scale": {
1366
+ "dtype": "float32",
1367
+ "shape": [4, 5],
1368
+ "data": {
1369
+ "kind": "values",
1370
+ "values": [0.23958276212215424, -0.3698011636734009, 0.9725357890129089, 2.1338682174682617, 0.40641549229621887, -0.19317670166492462, 0.7557402849197388, -0.5391326546669006, -0.7496903538703918, 0.03280874714255333, -2.582796573638916, -1.1539503335952759, -0.3479618430137634, -1.3533889055252075, -1.0326430797576904, -0.43674832582473755, -1.642965316772461, -0.4060717821121216, -0.5352701544761658, 0.02540520764887333]
1371
+ }
1372
+ },
1373
+ "b": {
1374
+ "dtype": "float32",
1375
+ "shape": [4, 5],
1376
+ "data": {
1377
+ "kind": "values",
1378
+ "values": [1.1541839838027954, 0.17250441014766693, 0.02106202207505703, 0.09945445507764816, 0.22739277780056, -1.0167386531829834, -0.11477532237768173, 0.30875125527381897, -1.3707599639892578, 0.8656529188156128, 1.081376075744629, -0.6313759684562683, -0.24133779108524323, -0.8781903386116028, 0.6993804574012756, -1.0612223148345947, -0.2224770039319992, -0.8589199185371399, 0.05095427855849266, -1.79422926902771]
1379
+ }
1380
+ }
1381
+ },
1382
+ "outputs": {
1383
+ "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.00005 },
1384
+ "mean": { "dtype": "float32", "shape": [2, 3, 1, 1], "tolerance": 0.00002 },
1385
+ "invStdDev": { "dtype": "float32", "shape": [2, 3, 1, 1], "tolerance": 0.0005 }
1386
+ }
1387
+ },
1388
+ {
1389
+ "name": "onnx_backend_layer_normalization_4d_axis_negative_2",
1390
+ "provenance": {
1391
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_4d_axis_negative_2"
1392
+ },
1393
+ "attrs": { "axis": -2, "epsilon": 0.00001 },
1394
+ "inputs": {
1395
+ "x": {
1396
+ "dtype": "float32",
1397
+ "shape": [2, 3, 4, 5],
1398
+ "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_input_x" } }
1399
+ },
1400
+ "scale": {
1401
+ "dtype": "float32",
1402
+ "shape": [4, 5],
1403
+ "data": {
1404
+ "kind": "values",
1405
+ "values": [1.326461672782898, -0.9646064043045044, 0.059894684702157974, -0.21252304315567017, -0.7621145248413086, -0.8877801299095154, 0.9363985657691956, -0.525640606880188, 0.2711701989173889, -0.8014968633651733, -0.6471814513206482, 0.4722471535205841, 0.9304084777832031, -0.17531640827655792, -1.421919822692871, 1.9979560375213623, -0.8565493226051331, -1.5415873527526855, 2.5944244861602783, -0.40403228998184204]
1406
+ }
1407
+ },
1408
+ "b": {
1409
+ "dtype": "float32",
1410
+ "shape": [4, 5],
1411
+ "data": {
1412
+ "kind": "values",
1413
+ "values": [-1.4617327451705933, -0.6834397912025452, 0.36754488945007324, 0.19031155109405518, -0.8517292141914368, 1.822723627090454, -0.5215796828269958, -1.184686541557312, 0.9606934189796448, 1.329062819480896, -0.8174930810928345, -1.401347279548645, 1.0304383039474487, -2.047323703765869, -1.2266216278076172, 0.9674461483955383, -0.05535254627466202, -0.2639373540878296, 0.3528166115283966, -0.15277442336082458]
1414
+ }
1415
+ }
1416
+ },
1417
+ "outputs": {
1418
+ "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.00005 },
1419
+ "mean": { "dtype": "float32", "shape": [2, 3, 1, 1], "tolerance": 0.00002 },
1420
+ "invStdDev": { "dtype": "float32", "shape": [2, 3, 1, 1], "tolerance": 0.0005 }
1421
+ }
1422
+ },
1423
+ {
1424
+ "name": "onnx_backend_layer_normalization_4d_axis_negative_3",
1425
+ "provenance": {
1426
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_4d_axis_negative_3"
1427
+ },
1428
+ "attrs": { "axis": -3, "epsilon": 0.00001 },
1429
+ "inputs": {
1430
+ "x": {
1431
+ "dtype": "float32",
1432
+ "shape": [2, 3, 4, 5],
1433
+ "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_input_x" } }
1434
+ },
1435
+ "scale": {
1436
+ "dtype": "float32",
1437
+ "shape": [3, 4, 5],
1438
+ "data": {
1439
+ "kind": "values",
1440
+ "values": [-0.3868708610534668, -0.5102927684783936, 0.18392549455165863, -0.3854897618293762, -1.601836085319519, -0.8871809244155884, -0.9327890276908875, 1.2433193922042847, 0.8126740455627441, 0.5872593522071838, -0.5053583383560181, -0.8157915472984314, -0.5075175762176514, -1.051880121231079, 2.4972004890441895, -2.245321750640869, 0.5640085339546204, -1.2845523357391357, -0.1043434888124466, -0.9880019426345825, -1.177628993988037, -1.1401963233947754, 1.7549861669540405, -0.13298842310905457, -0.7657021880149841, 0.5557869672775269, 0.010349314659833908, 0.7200337648391724, -1.8242566585540771, 0.3036039173603058, 0.7726948261260986, -1.6615983247756958, 0.44819527864456177, 1.6961815357208252, -0.014857703819870949, 0.8214059472084045, 0.670570433139801, -0.7075057029724121, 0.03976673632860184, -1.5669946670532227, -0.45130303502082825, 0.2656879723072052, 0.723100483417511, 0.024612125009298325, 0.7199837565422058, -1.1029062271118164, -0.10169727355241776, 0.01927938498556614, 1.8495912551879883, -0.21416665613651276, -0.4990166425704956, 0.021351223811507225, -0.9191134572029114, 0.1927538514137268, -0.3650552034378052, -1.7913275957107544, -0.05858655273914337, -0.317543089389801, -1.6324232816696167, -0.06713415682315826]
1441
+ }
1442
+ },
1443
+ "b": {
1444
+ "dtype": "float32",
1445
+ "shape": [3, 4, 5],
1446
+ "data": {
1447
+ "kind": "values",
1448
+ "values": [1.4893559217453003, 0.5213037729263306, 0.6119272112846375, -1.3414967060089111, 0.4768983721733093, 0.1484495848417282, 0.5290452241897583, 0.42262861132621765, -1.3597806692123413, -0.041400812566280365, -0.7578708529472351, -0.05008409544825554, -0.8974009156227112, 1.3124703168869019, -0.8589723706245422, -0.8989421725273132, 0.0745864063501358, -1.077099084854126, -0.4246633052825928, -0.8299645781517029, 1.4111720323562622, 0.7858038544654846, -0.05746951699256897, -0.39121705293655396, 0.9409176111221313, 0.40520408749580383, 0.4980524182319641, -0.026192236691713333, -1.688230037689209, -0.1124659851193428, -0.5324898958206177, 0.6450552940368652, 1.0118424892425537, -0.6579510569572449, 0.4683852195739746, 1.7358789443969727, -0.6677127480506897, 1.6819217205047607, -0.8525858521461487, 0.0229597557336092, -0.011145612224936485, 0.011498900130391121, -0.8376780152320862, -0.5911831259727478, -0.6677202582359314, 0.32696259021759033, 0.33003512024879456, 2.2259442806243896, 1.3709889650344849, -0.5098432302474976, 0.3248696029186249, 0.9971179962158203, 0.030601823702454567, -0.06964157521724701, 0.0515749417245388, 0.8672766089439392, -0.8483205437660217, -0.32566946744918823, 0.47043314576148987, 0.3114470839500427]
1449
+ }
1450
+ }
1451
+ },
1452
+ "outputs": {
1453
+ "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.00005 },
1454
+ "mean": { "dtype": "float32", "shape": [2, 1, 1, 1], "tolerance": 0.00002 },
1455
+ "invStdDev": { "dtype": "float32", "shape": [2, 1, 1, 1], "tolerance": 0.0005 }
1456
+ }
1457
+ },
1458
+ {
1459
+ "name": "onnx_backend_layer_normalization_4d_axis_negative_4",
1460
+ "provenance": {
1461
+ "source": "cmake/external/onnx/onnx/backend/test/data/node/test_layer_normalization_4d_axis_negative_4"
1462
+ },
1463
+ "attrs": { "axis": -4, "epsilon": 0.00001 },
1464
+ "inputs": {
1465
+ "x": {
1466
+ "dtype": "float32",
1467
+ "shape": [2, 3, 4, 5],
1468
+ "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_layer_normalization_input_x" } }
1469
+ },
1470
+ "scale": {
1471
+ "dtype": "float32",
1472
+ "shape": [2, 3, 4, 5],
1473
+ "data": {
1474
+ "kind": "values",
1475
+ "values": [0.6984571218490601, 0.003770889015868306, 0.9318483471870422, 0.33996498584747314, -0.01568211242556572, 0.1609281748533249, -0.1906534880399704, -0.3948495090007782, -0.26773354411125183, -1.1280113458633423, 0.2804417014122009, -0.9931235909461975, 0.841631293296814, -0.24945858120918274, 0.04949498176574707, 0.49383679032325745, 0.6433144807815552, -1.5706233978271484, -0.20690368115901947, 0.8801789283752441, -1.698105812072754, 0.3872804641723633, -2.2555642127990723, -1.022506833076477, 0.03863055258989334, -1.6567151546478271, -0.9855107665061951, -1.4718350172042847, 1.6481349468231201, 0.16422775387763977, 0.5672903060913086, -0.22267509996891022, -0.353431761264801, -1.6164741516113281, -0.2918373644351959, -0.7614921927452087, 0.8579239249229431, 1.1411018371582031, 1.466578722000122, 0.8525519371032715, -0.5986539125442505, -1.1158969402313232, 0.7666631937026978, 0.35629281401634216, -1.768538475036621, 0.3554818034172058, 0.8145198225975037, 0.05892558768391609, -0.18505367636680603, -0.8076484799385071, -1.4465347528457642, 0.8002979755401611, -0.3091144561767578, -0.23346665501594543, 1.732721209526062, 0.6845011115074158, 0.37082499265670776, 0.14206179976463318, 1.519994854927063, 1.719589352607727, 0.9295051097869873, 0.5822246074676514, -2.0946030616760254, 0.12372191250324249, -0.13010695576667786, 0.09395322948694229, 0.9430460929870605, -2.7396771907806396, -0.5693120360374451, 0.26990434527397156, -0.4668455421924591, -1.4169061183929443, 0.8689634799957275, 0.276871919631958, -0.9711045622825623, 0.3148171901702881, 0.8215857148170471, 0.005292646121233702, 0.8005648255348206, 0.07826017588376999, -0.3952289819717407, -1.1594204902648926, -0.08593076467514038, 0.19429293274879456, 0.875832736492157, -0.1151074692606926, 0.4574156105518341, -0.9646120071411133, -0.782629132270813, -0.11038929969072342, -1.0546284914016724, 0.8202478289604187, 0.46313032507896423, 0.27909576892852783, 0.33890411257743835, 2.021043539047241, -0.46886420249938965, -2.2014412879943848, 0.19930019974708557, -0.05060354247689247, -0.5175190567970276, -0.9788298606872559, -0.43918952345848083, 0.18133842945098877, -0.5028166770935059, 2.4124536514282227, -0.9605043530464172, -0.793117344379425, -2.2886199951171875, 0.2514844238758087, -2.016406536102295, -0.5394546389579773, -0.27567052841186523, -0.709727942943573, 1.7388726472854614, 0.9943943619728088, 1.3191368579864502, -0.8824188113212585, 1.1285940408706665, 0.4960009455680847]
1476
+ }
1477
+ },
1478
+ "b": {
1479
+ "dtype": "float32",
1480
+ "shape": [2, 3, 4, 5],
1481
+ "data": {
1482
+ "kind": "values",
1483
+ "values": [0.7714059352874756, 1.029438853263855, -0.9087632298469543, -0.4243176281452179, 0.8625960350036621, -2.6556191444396973, 1.5133280754089355, 0.5531320571899414, -0.045703962445259094, 0.2205076515674591, -1.0299352407455444, -0.3499433696269989, 1.1002843379974365, 1.2980220317840576, 2.6962239742279053, -0.07392466813325882, -0.6585529446601868, -0.5142339468002319, -1.0180418491363525, -0.07785475254058838, 0.38273242115974426, -0.03424227982759476, 1.0963468551635742, -0.23421579599380493, -0.3474506437778473, -0.5812684893608093, -1.6326345205307007, -1.5677677392959595, -1.1791579723358154, 1.3014280796051025, 0.8952602744102478, 1.3749641180038452, -1.3322116136550903, -1.9686247110366821, -0.6600562930107117, 0.17581894993782043, 0.49869027733802795, 1.0479722023010254, 0.2842796742916107, 1.7426687479019165, -0.22260567545890808, -0.9130792021751404, -1.6812182664871216, -0.8889713287353516, 0.2421179562807083, -0.8887202739715576, 0.9367424845695496, 1.4123276472091675, -2.369586944580078, 0.8640522956848145, -2.2396039962768555, 0.40149906277656555, 1.2248705625534058, 0.06485610455274582, -1.2796891927719116, -0.5854312181472778, -0.26164543628692627, -0.18224477767944336, -0.2028968334197998, -0.10988277941942215, 0.21348005533218384, -1.2085736989974976, -0.24201983213424683, 1.518261194229126, -0.3846454322338104, -0.4438360929489136, 1.0781973600387573, -2.5591845512390137, 1.1813786029815674, -0.6319037675857544, 0.1639285683631897, 0.09632135927677155, 0.9424681067466736, -0.26759475469589233, -0.6780257821083069, 1.2978458404541016, -2.3641738891601562, 0.020334182307124138, -1.3479254245758057, -0.7615733742713928, 2.011256694793701, -0.04459542781114578, 0.19506970047950745, -1.7815628051757812, -0.7290446758270264, 0.1965574026107788, 0.354757696390152, 0.616886556148529, 0.00862789899110794, 0.5270041823387146, 0.4537819027900696, -1.8297404050827026, 0.037005722522735596, 0.7679024338722229, 0.5898798108100891, -0.36385881900787354, -0.8056265115737915, -1.118311882019043, -0.13105401396751404, 1.1330798864364624, -1.9518041610717773, -0.6598917245864868, -1.1398024559020996, 0.7849575281143188, -0.554309606552124, -0.47063764929771423, -0.21694956719875336, 0.44539326429367065, -0.3923889994621277, -3.046143054962158, 0.5433118939399719, 0.43904295563697815, -0.2195410281419754, -1.0840365886688232, 0.35178011655807495, 0.37923553586006165, -0.47003287076950073, -0.2167314738035202, -0.9301565289497375, -0.1785890907049179]
1484
+ }
1485
+ }
1486
+ },
1487
+ "outputs": {
1488
+ "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.00005 },
1489
+ "mean": { "dtype": "float32", "shape": [1, 1, 1, 1], "tolerance": 0.00002 },
1490
+ "invStdDev": { "dtype": "float32", "shape": [1, 1, 1, 1], "tolerance": 0.0005 }
1491
+ }
1492
+ },
1493
+ {
1494
+ "name": "ort_last_axis_scale_only_small",
1495
+ "provenance": {
1496
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
1497
+ "test": "LayerNormTest.LayerNorm_Scale"
1498
+ },
1499
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1500
+ "inputs": {
1501
+ "x": {
1502
+ "dtype": "float32",
1503
+ "shape": [2, 2, 2],
1504
+ "data": {
1505
+ "kind": "values",
1506
+ "values": [-10.264, 8.6453, 43.1561, -0.641239, -8.2164, 0.11412, 41.3156, 3.0458]
1507
+ }
1508
+ },
1509
+ "scale": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-0.6953, 5.1824] } }
1510
+ },
1511
+ "outputs": {
1512
+ "y": {
1513
+ "dtype": "float32",
1514
+ "shape": [2, 2, 2],
1515
+ "tolerance": 0.0001,
1516
+ "data": { "kind": "values", "values": [0.6953, 5.1824, -0.6953, -5.1824, 0.6953, 5.1824, -0.6953, -5.1824] }
1517
+ }
1518
+ }
1519
+ },
1520
+ {
1521
+ "name": "ort_last_axis_scale_bias_small",
1522
+ "provenance": {
1523
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
1524
+ "test": "LayerNormTest.LayerNorm_Scale_Bias"
1525
+ },
1526
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1527
+ "inputs": {
1528
+ "x": {
1529
+ "dtype": "float32",
1530
+ "shape": [1, 3, 2],
1531
+ "data": { "kind": "values", "values": [1.2416, 0.946123, 13.1685, 0.36423, 21.145, 0.03941] }
1532
+ },
1533
+ "scale": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-0.6953, 5.1824] } },
1534
+ "b": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.6435, -0.3964] } }
1535
+ },
1536
+ "outputs": {
1537
+ "y": {
1538
+ "dtype": "float32",
1539
+ "shape": [1, 3, 2],
1540
+ "tolerance": 0.0001,
1541
+ "data": { "kind": "values", "values": [-0.0516, -5.5776, -0.0518, -5.5788, -0.0518, -5.5788] }
1542
+ }
1543
+ }
1544
+ },
1545
+ {
1546
+ "name": "ort_last_axis_full_shape_scale_bias",
1547
+ "provenance": {
1548
+ "source": "onnxruntime/test/contrib_ops/layer_norm_op_test.cc",
1549
+ "test": "LayerNormTest.LayerNorm_Scale_Bias_NoBroadcast"
1550
+ },
1551
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1552
+ "inputs": {
1553
+ "x": {
1554
+ "dtype": "float32",
1555
+ "shape": [2, 2, 2],
1556
+ "data": { "kind": "values", "values": [-1.0, 2.0, 3.0, -4.0, -10.264, 8.6453, 43.1561, -0.641239] }
1557
+ },
1558
+ "scale": {
1559
+ "dtype": "float32",
1560
+ "shape": [2, 2, 2],
1561
+ "data": { "kind": "values", "values": [-0.1, 1.7, -0.6953, 5.1824, -0.1, 1.7, -0.6953, 5.1824] }
1562
+ },
1563
+ "b": {
1564
+ "dtype": "float32",
1565
+ "shape": [2, 2, 2],
1566
+ "data": { "kind": "values", "values": [-2.0, 0.3, 0.0, 0.0, -2.0, 0.3, 0.0, 0.0] }
1567
+ }
1568
+ },
1569
+ "outputs": {
1570
+ "y": {
1571
+ "dtype": "float32",
1572
+ "shape": [2, 2, 2],
1573
+ "tolerance": 0.0001,
1574
+ "data": { "kind": "values", "values": [-1.9, 2.0, -0.6953, -5.1824, -1.9, 2.0, -0.6953, -5.1824] }
1575
+ }
1576
+ }
1577
+ },
1578
+ {
1579
+ "name": "f16_realistic_hidden2048_bias_stats",
1580
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1581
+ "inputs": {
1582
+ "x": {
1583
+ "dtype": "float16",
1584
+ "shape": [8, 2048],
1585
+ "data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.027, "scale": 0.5 }
1586
+ },
1587
+ "scale": {
1588
+ "dtype": "float16",
1589
+ "shape": [2048],
1590
+ "data": { "kind": "fillFloat32", "sinStep": 0.021, "cosStep": 0.011, "scale": 0.25, "offset": 1.0 }
1591
+ },
1592
+ "b": {
1593
+ "dtype": "float16",
1594
+ "shape": [2048],
1595
+ "data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.029, "scale": 0.1 }
1596
+ }
1597
+ },
1598
+ "outputs": {
1599
+ "y": { "dtype": "float16", "shape": [8, 2048], "tolerance": 0.005 },
1600
+ "mean": { "dtype": "float32", "shape": [8, 1], "tolerance": 0.005 },
1601
+ "invStdDev": { "dtype": "float32", "shape": [8, 1], "tolerance": 0.02 }
1602
+ }
1603
+ },
1604
+ {
1605
+ "name": "f16_broadcast_scale_bias_generic",
1606
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1607
+ "inputs": {
1608
+ "x": {
1609
+ "dtype": "float16",
1610
+ "shape": [4, 2, 2],
1611
+ "data": {
1612
+ "kind": "values",
1613
+ "values": [0.5, -0.5, 1.0, -1.0, 0.25, 0.75, -0.25, 0.6, 0.9, 0.1, -0.4, 0.4, 0.2, -0.8, 0.7, -0.3]
1614
+ }
1615
+ },
1616
+ "scale": {
1617
+ "dtype": "float16",
1618
+ "shape": [1, 2, 2],
1619
+ "data": { "kind": "values", "values": [1.2, 0.8, 1.0, 1.1] }
1620
+ },
1621
+ "b": { "dtype": "float16", "shape": [1, 2, 2], "data": { "kind": "values", "values": [0.1, -0.1, 0.05, 0.2] } }
1622
+ },
1623
+ "outputs": { "y": { "dtype": "float16", "shape": [4, 2, 2], "tolerance": 0.005 } }
1624
+ },
1625
+ {
1626
+ "name": "f16_suffix_axis_bias_stats",
1627
+ "attrs": { "epsilon": 0.00001, "axis": 1 },
1628
+ "inputs": {
1629
+ "x": {
1630
+ "dtype": "float16",
1631
+ "shape": [2, 4, 8],
1632
+ "data": {
1633
+ "kind": "values",
1634
+ "values": [0.4, 0.4413, 0.4613, 0.4606, 0.4411, 0.4055, 0.3572, 0.3001, 0.2386, 0.1768, 0.1189, 0.0685, 0.0287, 0.0017, -0.0111, -0.0095, 0.0058, 0.0334, 0.0707, 0.1146, 0.1613, 0.207, 0.2474, 0.2788, 0.2977, 0.3012, 0.2873, 0.2549, 0.2039, 0.1353, 0.0512, -0.0455, -0.1509, -0.2605, -0.3694, -0.4726, -0.5651, -0.6421, -0.6995, -0.734, -0.7433, -0.7261, -0.6823, -0.6131, -0.5207, -0.4086, -0.2809, -0.1427, 0.0005, 0.1431, 0.2794, 0.404, 0.5123, 0.6001, 0.6645, 0.7035, 0.7164, 0.7036, 0.6666, 0.6081, 0.5317, 0.4416, 0.3425, 0.2394]
1635
+ }
1636
+ },
1637
+ "scale": {
1638
+ "dtype": "float16",
1639
+ "shape": [4, 8],
1640
+ "data": {
1641
+ "kind": "values",
1642
+ "values": [1.15, 1.1804, 1.2075, 1.2303, 1.2474, 1.258, 1.2613, 1.2569, 1.2447, 1.2247, 1.1975, 1.1638, 1.1246, 1.0811, 1.0347, 0.9869, 0.9393, 0.8935, 0.8509, 0.813, 0.781, 0.7558, 0.738, 0.7282, 0.7265, 0.7325, 0.7459, 0.7659, 0.7914, 0.8214, 0.8544, 0.8891]
1643
+ }
1644
+ },
1645
+ "b": {
1646
+ "dtype": "float16",
1647
+ "shape": [4, 8],
1648
+ "data": {
1649
+ "kind": "values",
1650
+ "values": [0.05, 0.0564, 0.0585, 0.0567, 0.0514, 0.0436, 0.0342, 0.0243, 0.0148, 0.0069, 0.001, -0.0022, -0.0026, -0.0003, 0.0041, 0.0102, 0.0168, 0.0232, 0.0284, 0.0314, 0.0315, 0.0283, 0.0216, 0.0116, -0.0014, -0.0164, -0.0324, -0.0484, -0.0631, -0.0752, -0.0837, -0.0878]
1651
+ }
1652
+ }
1653
+ },
1654
+ "outputs": {
1655
+ "y": { "dtype": "float16", "shape": [2, 4, 8], "tolerance": 0.005 },
1656
+ "mean": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.005 },
1657
+ "invStdDev": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.02 }
1658
+ }
1659
+ },
1660
+ {
1661
+ "name": "per_row_scale_bias_no_outer_broadcast_generic_offset",
1662
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1663
+ "inputs": {
1664
+ "x": {
1665
+ "dtype": "float32",
1666
+ "shape": [3, 8],
1667
+ "data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.29 }
1668
+ },
1669
+ "scale": {
1670
+ "dtype": "float32",
1671
+ "shape": [3, 8],
1672
+ "data": { "kind": "fillFloat32", "sinStep": 0.21, "cosStep": 0.07, "scale": 0.4, "offset": 1.0 }
1673
+ },
1674
+ "b": {
1675
+ "dtype": "float32",
1676
+ "shape": [3, 8],
1677
+ "data": { "kind": "fillFloat32", "sinStep": 0.05, "cosStep": 0.17, "scale": 0.2 }
1678
+ }
1679
+ },
1680
+ "outputs": { "y": { "dtype": "float32", "shape": [3, 8], "tolerance": 0.000002 } }
1681
+ },
1682
+ {
1683
+ "name": "vec4_stats_subgroup_wide_hidden2048_f32_multi_subgroup_combine",
1684
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1685
+ "inputs": {
1686
+ "x": {
1687
+ "dtype": "float32",
1688
+ "shape": [2, 2048],
1689
+ "data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.031, "scale": 1.5 }
1690
+ },
1691
+ "scale": {
1692
+ "dtype": "float32",
1693
+ "shape": [2048],
1694
+ "data": { "kind": "fillFloat32", "sinStep": 0.003, "cosStep": 0.005, "scale": 0.25, "offset": 1.0 }
1695
+ }
1696
+ },
1697
+ "outputs": {
1698
+ "y": { "dtype": "float32", "shape": [2, 2048], "tolerance": 0.00001 },
1699
+ "mean": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.00002 },
1700
+ "invStdDev": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.0001 }
1701
+ }
1702
+ },
1703
+ {
1704
+ "name": "f32_last_axis_unaligned_hidden2050_bias",
1705
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1706
+ "inputs": {
1707
+ "x": {
1708
+ "dtype": "float32",
1709
+ "shape": [2, 2050],
1710
+ "data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.031, "scale": 1.5 }
1711
+ },
1712
+ "scale": {
1713
+ "dtype": "float32",
1714
+ "shape": [2050],
1715
+ "data": { "kind": "fillFloat32", "sinStep": 0.003, "cosStep": 0.005, "scale": 0.25, "offset": 1.0 }
1716
+ },
1717
+ "b": {
1718
+ "dtype": "float32",
1719
+ "shape": [2050],
1720
+ "data": { "kind": "fillFloat32", "sinStep": 0.007, "cosStep": 0.011, "scale": 0.1 }
1721
+ }
1722
+ },
1723
+ "outputs": { "y": { "dtype": "float32", "shape": [2, 2050], "tolerance": 0.00001 } }
1724
+ },
1725
+ {
1726
+ "name": "zero_variance_constant_row_vec4_width_exact_zeros",
1727
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1728
+ "inputs": {
1729
+ "x": { "dtype": "float32", "shape": [1, 8], "data": { "kind": "constant", "value": 5.0 } },
1730
+ "scale": { "dtype": "float32", "shape": [8], "data": { "kind": "constant", "value": 1.0 } }
1731
+ },
1732
+ "outputs": {
1733
+ "y": {
1734
+ "dtype": "float32",
1735
+ "shape": [1, 8],
1736
+ "tolerance": 1e-7,
1737
+ "data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }
1738
+ }
1739
+ }
1740
+ },
1741
+ {
1742
+ "name": "empty_last_axis_zero_hidden_noop",
1743
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1744
+ "inputs": {
1745
+ "x": { "dtype": "float32", "shape": [3, 0], "data": { "kind": "values", "values": [] } },
1746
+ "scale": { "dtype": "float32", "shape": [0], "data": { "kind": "values", "values": [] } }
1747
+ },
1748
+ "outputs": { "y": { "dtype": "float32", "shape": [3, 0], "data": { "kind": "values", "values": [] } } }
1749
+ },
1750
+ {
1751
+ "name": "last_axis_broadcast_scale_stats_generic_path",
1752
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1753
+ "inputs": {
1754
+ "x": {
1755
+ "dtype": "float32",
1756
+ "shape": [2, 4],
1757
+ "data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.21 }
1758
+ },
1759
+ "scale": { "dtype": "float32", "shape": [1], "data": { "kind": "constant", "value": 0.5 } }
1760
+ },
1761
+ "outputs": {
1762
+ "y": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000002 },
1763
+ "mean": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 },
1764
+ "invStdDev": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.00001 }
1765
+ }
1766
+ },
1767
+ {
1768
+ "name": "last_axis_broadcast_scale_bias_stats_generic_path",
1769
+ "attrs": { "epsilon": 0.00001, "axis": -1 },
1770
+ "inputs": {
1771
+ "x": {
1772
+ "dtype": "float32",
1773
+ "shape": [2, 4],
1774
+ "data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.07 }
1775
+ },
1776
+ "scale": { "dtype": "float32", "shape": [1], "data": { "kind": "constant", "value": 0.5 } },
1777
+ "b": { "dtype": "float32", "shape": [1], "data": { "kind": "constant", "value": 0.25 } }
1778
+ },
1779
+ "outputs": {
1780
+ "y": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000002 },
1781
+ "mean": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 },
1782
+ "invStdDev": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.00001 }
1783
+ }
1784
+ }
1785
+ ]
1786
+ }