File size: 9,154 Bytes
c1ff05f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66007ce
c1ff05f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66007ce
c1ff05f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66007ce
c1ff05f
 
 
 
 
 
 
 
 
 
 
 
66007ce
c1ff05f
 
 
 
 
 
 
 
 
 
 
 
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
{
  "cases": [
    {
      "name": "f32_values",
      "attrs": { "alpha": 1.5 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [6],
          "data": { "kind": "values", "values": [-3.0, -1.0, 0.0, 0.5, 1.0, 3.0] }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [6], "tolerance": 0.000001 } }
    },
    {
      "name": "f32_alpha_zero_subnormal_half_gate_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/providers/cpu/activation/activation_op_test.cc",
        "test": "ActivationOpTest.Swish",
        "notes": "With alpha=0, Swish is exactly x/2, so signed subnormal inputs should not disappear."
      },
      "attrs": { "alpha": 0 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [4],
          "data": { "kind": "values", "values": [-1e-39, -1e-40, 1e-40, 1e-39] }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [4], "tolerance": 0 } }
    },
    {
      "name": "f32_alpha_zero_subnormal_half_gate_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/providers/cpu/activation/activation_op_test.cc",
        "test": "ActivationOpTest.Swish",
        "notes": "On the scalar path with alpha=0, Swish is exactly x/2 for signed subnormal inputs."
      },
      "attrs": { "alpha": 0 },
      "inputs": {
        "x": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [-1e-40, 0.0, 1e-40] } }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [3], "tolerance": 1e-43 } }
    },
    {
      "name": "f32_extreme_finite_stability",
      "attrs": { "alpha": 1 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [9],
          "data": { "kind": "values", "values": [-1000.0, -100.0, -20.0, -1.0, 0.0, 1.0, 20.0, 100.0, 1000.0] }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [9], "tolerance": 0.000001 } }
    },
    {
      "name": "f32_alpha_zero_halves_input",
      "attrs": { "alpha": 0 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [7],
          "data": { "kind": "values", "values": [-100.0, -3.0, -0.5, 0.0, 0.5, 3.0, 100.0] }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [7], "tolerance": 0.000001 } }
    },
    {
      "name": "f32_negative_alpha_extreme_finite_stability",
      "attrs": { "alpha": -1 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [9],
          "data": { "kind": "values", "values": [-1000.0, -100.0, -20.0, -1.0, 0.0, 1.0, 20.0, 100.0, 1000.0] }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [9], "tolerance": 0.000001 } }
    },
    {
      "name": "f32_nan_input",
      "attrs": { "alpha": 0.75 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [5],
          "data": { "kind": "values", "values": ["NaN", -4.0, 0.0, 4.0, "NaN"] }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [5], "tolerance": 0.000001, "allowNaN": true } }
    },
    {
      "name": "f32_nonfinite_endpoints_alpha_one",
      "provenance": {
        "notes": "Nonfinite edge: -Infinity follows the literal formula into NaN, +Infinity stays +Infinity."
      },
      "attrs": { "alpha": 1 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [6],
          "data": { "kind": "values", "values": ["-Infinity", -1.0, 0.0, 1.0, "Infinity", "NaN"] }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [6], "tolerance": 0.000001, "allowNaN": true } }
    },
    {
      "name": "rank0_negative_alpha_scalar",
      "attrs": { "alpha": -0.5 },
      "inputs": { "x": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [4.0] } } },
      "outputs": { "y": { "dtype": "float32", "shape": [], "tolerance": 0.000001 } }
    },
    {
      "name": "f16_values",
      "attrs": { "alpha": 1.25 },
      "inputs": {
        "x": {
          "dtype": "float16",
          "shape": [7],
          "data": { "kind": "values", "values": [-12.0, -4.0, -0.5, 0.0, 0.5, 4.0, 12.0] }
        }
      },
      "outputs": { "y": { "dtype": "float16", "shape": [7], "tolerance": 0.001 } }
    },
    {
      "name": "f16_alpha_zero_halves_input",
      "attrs": { "alpha": 0 },
      "inputs": {
        "x": {
          "dtype": "float16",
          "shape": [7],
          "data": { "kind": "values", "values": [-16.0, -4.0, -0.5, 0.0, 0.5, 4.0, 16.0] }
        }
      },
      "outputs": { "y": { "dtype": "float16", "shape": [7], "tolerance": 0.001 } }
    },
    {
      "name": "onnx_backend_empty_rank4",
      "provenance": {
        "source": "cmake/external/onnx/onnx/backend/test/case/node/swish.py",
        "test": "Swish.export",
        "notes": "Elementwise empty tensor edge: preserve a zero inner dimension with no work items."
      },
      "attrs": { "alpha": 1 },
      "inputs": { "x": { "dtype": "float32", "shape": [1, 2, 0, 3], "data": { "kind": "values", "values": [] } } },
      "outputs": { "y": { "dtype": "float32", "shape": [1, 2, 0, 3] } }
    },
    {
      "name": "onnx_backend_expanded_alpha_two_rank3",
      "provenance": {
        "source": "cmake/external/onnx/onnx/backend/test/data/node/test_swish_expanded",
        "test": "test_swish_expanded",
        "notes": "Compact rank-3 projection with alpha != 1 to stress the generated formula path."
      },
      "attrs": { "alpha": 2 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [1, 2, 4],
          "data": { "kind": "values", "values": [-20.0, -2.0, -0.5, 0.0, 0.5, 2.0, 20.0, 40.0] }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [1, 2, 4], "tolerance": 0.000001 } }
    },
    {
      "name": "onnx_backend_alpha_one_example",
      "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_swish", "test": "test_swish" },
      "attrs": { "alpha": 1 },
      "inputs": { "x": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [3.0, 4.0, 5.0] } } },
      "outputs": { "y": { "dtype": "float32", "shape": [3], "tolerance": 0.000001 } }
    },
    {
      "name": "vec4_f16_lanes",
      "inputs": {
        "x": {
          "dtype": "float16",
          "shape": [16],
          "data": {
            "kind": "values",
            "values": [-6.0, -4.0, -3.0, -2.0, -1.5, -1.0, -0.5, -0.25, 0.0, 0.25, 0.5, 1.0, 1.5, 2.0, 4.0, 6.0]
          }
        }
      },
      "outputs": { "y": { "dtype": "float16", "shape": [16], "tolerance": 0.001, "relTolerance": 0.002 } }
    },
    {
      "name": "alpha_zero_vec4_path",
      "attrs": { "alpha": 0 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [8],
          "data": { "kind": "values", "values": [-100.0, -3.0, -0.5, 0.0, 0.5, 3.0, 10.0, 100.0] }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [8], "tolerance": 0.000001 } }
    },
    {
      "name": "nondefault_alpha_vec4_large_negative",
      "attrs": { "alpha": -2.5 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [8],
          "data": { "kind": "values", "values": [-10.0, -5.0, -1.0, -0.5, 0.0, 0.5, 1.0, 10.0] }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [8], "tolerance": 0.000001 } }
    },
    {
      "name": "f32_vec4_sustained_4096",
      "provenance": { "notes": "A compact aligned float32 payload exercises vectorized Swish." },
      "attrs": { "alpha": 1 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [4096],
          "data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.019, "scale": 2.0 }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [4096], "tolerance": 0.00001, "relTolerance": 0.00001 } }
    },
    {
      "name": "f32_scalar_tail_4097",
      "provenance": { "notes": "An element count not divisible by four exercises scalar Swish." },
      "attrs": { "alpha": 1 },
      "inputs": {
        "x": {
          "dtype": "float32",
          "shape": [4097],
          "data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.023, "scale": 2.0 }
        }
      },
      "outputs": { "y": { "dtype": "float32", "shape": [4097], "tolerance": 0.00001, "relTolerance": 0.00001 } }
    }
  ]
}