File size: 8,815 Bytes
c4a6897
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
{
  "op": "com.microsoft.QuickGelu",
  "cases": [
    {
      "name": "dispatch_cliff_scalar_over_16M",
      "attrs": { "alpha": 1.702 },
      "inputs": {
        "X": { "dtype": "float32", "shape": [16776961], "data": { "kind": "linspace", "start": -4.0, "end": 4.0 } }
      },
      "outputs": { "Y": { "dtype": "float32", "shape": [16776961], "tolerance": 0.0001 } }
    },
    {
      "name": "ort_default_alpha_extreme_safe_sigmoid",
      "provenance": {
        "source": "onnxruntime/test/contrib_ops/activation_op_test.cc",
        "test": "ActivationOpTest.QuickGelu",
        "notes": "Default alpha path over very large magnitudes; the safe sigmoid should not overflow."
      },
      "inputs": {
        "X": {
          "dtype": "float32",
          "shape": [1, 9],
          "data": { "kind": "values", "values": [-1000.0, -100.0, -10.0, -1.0, 0.0, 1.0, 10.0, 100.0, 1000.0] }
        }
      },
      "outputs": {
        "Y": {
          "dtype": "float32",
          "shape": [1, 9],
          "tolerance": 0.000001,
          "data": {
            "kind": "values",
            "values": [0.0, 0.0, -2.980232238769531e-7, -0.15420421957969666, 0.0, 0.845795750617981, 10.0, 100.0, 1000.0]
          }
        }
      }
    },
    {
      "name": "ort_alpha_one_matches_silu_edges",
      "provenance": {
        "source": "onnxruntime/test/contrib_ops/activation_op_test.cc",
        "test": "ActivationOpTest.QuickGelu"
      },
      "attrs": { "alpha": 1 },
      "inputs": {
        "X": {
          "dtype": "float32",
          "shape": [7],
          "data": { "kind": "values", "values": [-100.0, -10.0, -1.0, 0.0, 1.0, 10.0, 100.0] }
        }
      },
      "outputs": {
        "Y": {
          "dtype": "float32",
          "shape": [7],
          "tolerance": 0.000001,
          "data": {
            "kind": "values",
            "values": [0.0, -0.0004538893699645996, -0.2689414322376251, 0.0, 0.7310585975646973, 9.99954605102539, 100.0]
          }
        }
      }
    },
    {
      "name": "ort_negative_alpha_flips_gate",
      "provenance": {
        "source": "onnxruntime/test/contrib_ops/activation_op_test.cc",
        "test": "ActivationOpTest.QuickGelu"
      },
      "attrs": { "alpha": -1.702 },
      "inputs": {
        "X": { "dtype": "float32", "shape": [5], "data": { "kind": "values", "values": [-3.0, -1.0, 0.0, 1.0, 3.0] } }
      },
      "outputs": {
        "Y": {
          "dtype": "float32",
          "shape": [5],
          "tolerance": 0.000001,
          "data": {
            "kind": "values",
            "values": [-2.981928825378418, -0.845795750617981, 0.0, 0.15420421957969666, 0.018071293830871582]
          }
        }
      }
    },
    {
      "name": "ort_negative_alpha_extreme_safe_sigmoid",
      "provenance": {
        "source": "onnxruntime/test/contrib_ops/activation_op_test.cc",
        "test": "ActivationOpTest.QuickGelu",
        "notes": "Upstream negative-alpha branch extended over the same large magnitudes as the positive-alpha ORT vector to guard the stable sigmoid reformulation."
      },
      "attrs": { "alpha": -1.702 },
      "inputs": {
        "X": {
          "dtype": "float32",
          "shape": [1, 9],
          "data": { "kind": "values", "values": [-1000.0, -100.0, -10.0, -1.0, 0.0, 1.0, 10.0, 100.0, 1000.0] }
        }
      },
      "outputs": {
        "Y": {
          "dtype": "float32",
          "shape": [1, 9],
          "tolerance": 0.000001,
          "data": {
            "kind": "values",
            "values": [-1000.0, -100.0, -10.0, -0.845795750617981, 0.0, 0.15420423448085785, 4.0579612914370955e-7, 0.0, 0.0]
          }
        }
      }
    },
    {
      "name": "ort_empty_rank4",
      "provenance": {
        "source": "onnxruntime/test/contrib_ops/activation_op_test.cc",
        "notes": "Empty tensors should preserve shape and produce no values."
      },
      "inputs": { "X": { "dtype": "float32", "shape": [1, 0, 2, 3], "data": { "kind": "values", "values": [] } } },
      "outputs": { "Y": { "dtype": "float32", "shape": [1, 0, 2, 3], "data": { "kind": "values", "values": [] } } }
    },
    {
      "name": "vec4_default_alpha_mixed_magnitudes",
      "provenance": {
        "source": "onnxruntime/test/contrib_ops/activation_op_test.cc",
        "test": "ActivationOpTest.QuickGelu",
        "notes": "numel divisible by 4 so the vec4 variant is exercised; default alpha over a spread of signs/magnitudes."
      },
      "inputs": {
        "X": {
          "dtype": "float32",
          "shape": [2, 4],
          "data": { "kind": "values", "values": [-2.0, -0.5, 0.0, 0.5, 2.0, 1.0, -1.0, 4.0] }
        }
      },
      "outputs": {
        "Y": {
          "dtype": "float32",
          "shape": [2, 4],
          "tolerance": 0.000001,
          "data": {
            "kind": "values",
            "values": [-0.06434137374162674, -0.14961156249046326, 0.0, 0.35038843750953674, 1.935658574104309, 0.845795750617981, -0.15420423448085785, 3.9955852031707764]
          }
        }
      }
    },
    {
      "name": "alpha_zero_halves_input",
      "provenance": {
        "source": "onnxruntime/test/contrib_ops/activation_op_test.cc",
        "test": "ActivationOpTest.QuickGelu",
        "notes": "Additional edge: alpha=0 makes sigmoid(alpha*x)=0.5 for every finite x."
      },
      "attrs": { "alpha": 0 },
      "inputs": {
        "X": { "dtype": "float32", "shape": [5], "data": { "kind": "values", "values": [-3.0, -1.0, 0.0, 1.0, 3.0] } }
      },
      "outputs": {
        "Y": {
          "dtype": "float32",
          "shape": [5],
          "tolerance": 0,
          "data": { "kind": "values", "values": [-1.5, -0.5, 0.0, 0.5, 1.5] }
        }
      }
    },
    {
      "name": "alpha_zero_subnormal_half_input_vec4_gpu_gap",
      "skipGpu": {
        "category": "permanent",
        "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 (f32 and f16); the kernel cannot preserve denormal inputs/outputs bit-exactly."
      },
      "provenance": {
        "source": "onnxruntime/test/contrib_ops/activation_op_test.cc",
        "test": "ActivationOpTest.QuickGelu",
        "notes": "With alpha=0, QuickGelu is exactly x/2, so signed subnormal inputs should not flush to zero in the vec4 path."
      },
      "attrs": { "alpha": 0 },
      "inputs": {
        "X": {
          "dtype": "float32",
          "shape": [4],
          "data": { "kind": "values", "values": [1e-40, -1e-40, 1e-38, -1e-38] }
        }
      },
      "outputs": {
        "Y": {
          "dtype": "float32",
          "shape": [4],
          "tolerance": 2e-45,
          "data": {
            "kind": "values",
            "values": [4.99997305055738e-41, -4.99997305055738e-41, 4.999999675228202e-39, -4.999999675228202e-39]
          }
        }
      }
    },
    {
      "name": "alpha_zero_subnormal_half_input_scalar_gpu_gap",
      "skipGpu": {
        "category": "permanent",
        "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 (f32 and f16); the kernel cannot preserve denormal inputs/outputs bit-exactly."
      },
      "provenance": {
        "source": "onnxruntime/test/contrib_ops/activation_op_test.cc",
        "test": "ActivationOpTest.QuickGelu",
        "notes": "Scalar-path companion for alpha=0 exact half-input subnormal behavior."
      },
      "attrs": { "alpha": 0 },
      "inputs": {
        "X": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1e-40, -1e-40, 1e-38] } }
      },
      "outputs": {
        "Y": {
          "dtype": "float32",
          "shape": [3],
          "tolerance": 2e-45,
          "data": { "kind": "values", "values": [4.99997305055738e-41, -4.99997305055738e-41, 4.999999675228202e-39] }
        }
      }
    },
    {
      "name": "f16_values",
      "attrs": { "alpha": 1.702 },
      "inputs": {
        "X": {
          "dtype": "float16",
          "shape": [8],
          "data": { "kind": "values", "values": [-4.0, -2.0, -0.5, 0.0, 0.5, 1.0, 2.0, 4.0] }
        }
      },
      "outputs": { "Y": { "dtype": "float16", "shape": [8], "tolerance": 0.005 } }
    },
    {
      "name": "f16_default_alpha_extreme_stable_sigmoid",
      "attrs": { "alpha": 1.702 },
      "inputs": {
        "X": {
          "dtype": "float16",
          "shape": [8],
          "data": { "kind": "values", "values": [-1000.0, -100.0, -10.0, -1.0, 1.0, 10.0, 100.0, 1000.0] }
        }
      },
      "outputs": { "Y": { "dtype": "float16", "shape": [8], "tolerance": 0.02 } }
    }
  ]
}