ai.onnx.SwiGLU / build /webgpu /test.json
Xenova's picture
Xenova HF Staff
sync 91d990483a17
d605e07 verified
Raw
History Blame
4.42 kB
{
"fixtureArrays": { "onnx_example_a": [1, -2, 3, 4, -1, 2, -3, 0.5], "onnx_example_b": [0.5, 1, -1, 2, 2, -1, 0.5, 1] },
"cases": [
{
"name": "onnx_default_rank2",
"provenance": {
"source": "onnx/backend/test/case/node/swiglu.py",
"test": "test_swiglu",
"notes": "Standard ONNX-28 example using the default alpha of one."
},
"inputs": {
"a": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_example_a" } }
},
"b": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_example_b" } }
}
},
"outputs": { "y": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000001 } }
},
{
"name": "onnx_alpha_half_rank2",
"provenance": {
"source": "onnx/backend/test/case/node/swiglu.py",
"test": "test_swiglu_alpha",
"notes": "Standard ONNX-28 example with alpha set to 0.5."
},
"attrs": { "alpha": 0.5 },
"inputs": {
"a": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_example_a" } }
},
"b": {
"dtype": "float32",
"shape": [2, 4],
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_example_b" } }
}
},
"outputs": { "y": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.000001 } }
},
{
"name": "onnx_float16_rank2",
"provenance": {
"source": "onnx/backend/test/case/node/swiglu.py",
"test": "test_swiglu_float16",
"notes": "Standard ONNX-28 float16 example. The fused kernel preserves the typed Swish and final Mul boundaries from the operator's Function body."
},
"inputs": {
"a": {
"dtype": "float16",
"shape": [2, 4],
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_example_a" } }
},
"b": {
"dtype": "float16",
"shape": [2, 4],
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_example_b" } }
}
},
"outputs": { "y": { "dtype": "float16", "shape": [2, 4], "tolerance": 0.001 } }
},
{
"name": "float16_function_stage_boundaries",
"provenance": {
"source": "onnx/defs/math/defs.cc",
"test": "SwiGLU-28 Function body",
"notes": "Separates the standard typed Swish and Mul stages from a one-cast fused-float32 implementation."
},
"attrs": { "alpha": -0.4201333224773407 },
"inputs": {
"a": { "dtype": "float16", "shape": [1], "data": { "kind": "values", "values": [-3.376953125] } },
"b": { "dtype": "float16", "shape": [1], "data": { "kind": "values", "values": [0.5576171875] } }
},
"outputs": {
"y": { "dtype": "float16", "shape": [1], "data": { "kind": "values", "values": [-1.515625] }, "tolerance": 0 }
}
},
{
"name": "odd_rank3_scalar_x4",
"attrs": { "alpha": -0.75 },
"inputs": {
"a": {
"dtype": "float32",
"shape": [1, 2, 3],
"data": { "kind": "values", "values": [-4.0, -1.0, -0.25, 0.0, 1.5, 5.0] }
},
"b": {
"dtype": "float32",
"shape": [1, 2, 3],
"data": { "kind": "values", "values": [0.5, -2.0, 4.0, 8.0, -1.0, 0.25] }
}
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 3], "tolerance": 0.000001 } }
},
{
"name": "rank0_scalar",
"attrs": { "alpha": 2 },
"inputs": {
"a": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [-1.25] } },
"b": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [3.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [], "tolerance": 0.000001 } }
},
{
"name": "empty_rank4",
"inputs": {
"a": { "dtype": "float32", "shape": [2, 0, 3, 1], "data": { "kind": "values", "values": [] } },
"b": { "dtype": "float32", "shape": [2, 0, 3, 1], "data": { "kind": "values", "values": [] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [2, 0, 3, 1] } }
}
]
}