File size: 6,409 Bytes
b7c7348 e34da4c b7c7348 | 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 | {
"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": "half_function_rounding_vec4",
"inputs": {
"a": {
"dtype": "float16",
"shape": [4],
"data": { "kind": "values", "values": [-1.8203125, 0.0611572265625, -1.30859375, 0.96337890625] }
},
"b": {
"dtype": "float16",
"shape": [4],
"data": { "kind": "values", "values": [1.298828125, -0.1517333984375, -1.8056640625, 2.80859375] }
}
},
"outputs": {
"y": {
"dtype": "float16",
"shape": [4],
"data": { "kind": "values", "values": [-0.329345703125, -0.004779815673828125, 0.50244140625, 1.9580078125] },
"tolerance": 0.000002
}
},
"provenance": {
"source": "ONNX SwiGLU-28 Function body",
"notes": "Negative and positive gates with explicit half Sigmoid, Swish and Mul edges, in vectorized and scalar-tail execution."
}
},
{
"name": "half_function_rounding_scalar_tail",
"inputs": {
"a": {
"dtype": "float16",
"shape": [5],
"data": { "kind": "values", "values": [-1.8203125, 0.0611572265625, -1.30859375, 0.96337890625, -1.8203125] }
},
"b": {
"dtype": "float16",
"shape": [5],
"data": {
"kind": "values",
"values": [1.298828125, -0.1517333984375, -1.8056640625, 2.80859375, 1.298828125]
}
}
},
"outputs": {
"y": {
"dtype": "float16",
"shape": [5],
"data": {
"kind": "values",
"values": [-0.329345703125, -0.004779815673828125, 0.50244140625, 1.9580078125, -0.329345703125]
},
"tolerance": 0.000002
}
},
"provenance": {
"source": "ONNX SwiGLU-28 Function body",
"notes": "Negative and positive gates with explicit half Sigmoid, Swish and Mul edges, in vectorized and scalar-tail execution."
}
},
{
"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] } }
}
]
}
|