ai.onnx.Swish / build /webgpu /test.json
Xenova's picture
Xenova HF Staff
sync 2e7068faf55e
c1ff05f verified
Raw
History Blame
9.34 kB
{
"op": "ai.onnx.Swish",
"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": "Scalar-path companion: 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": "ORT CPU validated 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": "Compact sibling for the f32 vec4 Swish benchmark; preserves a sustained vec4-aligned payload without benchmark-scale tensors."
},
"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": "Compact sibling for the odd-sized Swish scalar-fallback benchmark; count is intentionally not divisible by four."
},
"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 } }
}
]
}