ai.onnx.Sign / build /webgpu /test.json
Xenova's picture
Xenova HF Staff
sync 2e7068faf55e
67f32d3 verified
Raw
History Blame
12.1 kB
{
"op": "ai.onnx.Sign",
"cases": [
{
"name": "int16_scalar_boundaries",
"inputs": {
"input": { "dtype": "int16", "shape": [5], "data": { "kind": "values", "values": [-32768, -1, 0, 1, 32767] } }
},
"outputs": {
"output": {
"dtype": "int16",
"shape": [5],
"tolerance": 0,
"data": { "kind": "values", "values": [-1, -1, 0, 1, 1] }
}
}
},
{
"name": "f32_signed_subnormal_sign_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/math/sign_test.cc",
"test": "MathOpTest.Sign_float",
"notes": "Signed subnormal values have nonzero signs; flushing them to zero incorrectly returns 0."
},
"inputs": {
"input": {
"dtype": "float32",
"shape": [5],
"data": { "kind": "values", "values": [-1e-39, -1e-40, 0.0, 1e-40, 1e-39] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [5], "tolerance": 0 } }
},
{
"name": "f32_signed_subnormal_sign_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/providers/cpu/math/sign_test.cc",
"test": "MathOpTest.Sign_float",
"notes": "Vec4 companion for signed subnormal Sign behavior; optimized unary paths must preserve nonzero signs."
},
"inputs": {
"input": {
"dtype": "float32",
"shape": [4],
"data": { "kind": "values", "values": [-1e-40, 0.0, 1e-40, 1e-39] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [4], "tolerance": 0 } }
},
{
"name": "f32_values",
"provenance": { "source": "onnxruntime/test/providers/cpu/math/sign_test.cc", "test": "MathOpTest.Sign_float" },
"inputs": {
"input": {
"dtype": "float32",
"shape": [5],
"data": { "kind": "values", "values": [-2.0, -0.1, 0.0, 0.1, 2.0] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [5] } }
},
{
"name": "f32_zero_and_infinities",
"inputs": {
"input": {
"dtype": "float32",
"shape": [6],
"data": { "kind": "values", "values": ["-Infinity", 0.0, 0.0, 1e-7, -1e-7, "Infinity"] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [6], "tolerance": 0 } }
},
{
"name": "f16_values",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/sign_test.cc",
"test": "MathOpTest.Sign_MLFloat16"
},
"inputs": {
"input": {
"dtype": "float16",
"shape": [6],
"data": { "kind": "values", "values": [-4.0, -0.5, 0.0, 0.0, 0.5, 4.0] }
}
},
"outputs": { "output": { "dtype": "float16", "shape": [6], "tolerance": 0 } }
},
{
"name": "ort_int32_sequence",
"provenance": { "source": "onnxruntime/test/providers/cpu/math/sign_test.cc", "test": "MathOpTest.Sign_int64" },
"inputs": {
"input": { "dtype": "int32", "shape": [7], "data": { "kind": "values", "values": [-5, -4, -3, -2, -1, 0, 1] } }
},
"outputs": { "output": { "dtype": "int32", "shape": [7], "tolerance": 0 } }
},
{
"name": "ort_uint32_sequence",
"provenance": { "source": "onnxruntime/test/providers/cpu/math/sign_test.cc", "test": "MathOpTest.Sign_uint64" },
"inputs": {
"input": { "dtype": "uint32", "shape": [7], "data": { "kind": "values", "values": [0, 1, 2, 3, 4, 5, 6] } }
},
"outputs": { "output": { "dtype": "uint32", "shape": [7], "tolerance": 0 } }
},
{
"name": "ort_int8_sequence",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/sign_test.cc",
"test": "MathOpTest.Sign_int64",
"notes": "Uses the same signed integer sequence semantics as MathOpTest.Sign_int64 with logical int8 storage."
},
"inputs": {
"input": { "dtype": "int8", "shape": [7], "data": { "kind": "values", "values": [-5, -4, -3, -2, -1, 0, 1] } }
},
"outputs": { "output": { "dtype": "int8", "shape": [7], "tolerance": 0 } }
},
{
"name": "ort_uint8_sequence",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/sign_test.cc",
"test": "MathOpTest.Sign_uint64",
"notes": "Uses the same unsigned integer sequence semantics as MathOpTest.Sign_uint64 with logical uint8 storage."
},
"inputs": {
"input": { "dtype": "uint8", "shape": [7], "data": { "kind": "values", "values": [0, 1, 2, 3, 4, 5, 6] } }
},
"outputs": { "output": { "dtype": "uint8", "shape": [7], "tolerance": 0 } }
},
{
"name": "onnx_backend_float32_range",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_sign" },
"inputs": {
"input": {
"dtype": "float32",
"shape": [11],
"data": { "kind": "values", "values": [-5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [11], "tolerance": 0 } }
},
{
"name": "onnx_backend_sign",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_sign" },
"inputs": {
"input": {
"dtype": "float32",
"shape": [11],
"data": { "kind": "values", "values": [-5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [11], "tolerance": 0.00001 } }
},
{
"name": "vec4_f32_lanes",
"inputs": {
"input": {
"dtype": "float32",
"shape": [8],
"data": { "kind": "values", "values": [-5.0, -0.1, 0.0, 0.1, 5.0, "-Infinity", "Infinity", 2.0] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [8], "tolerance": 0 } }
},
{
"name": "vec4_f16_lanes",
"inputs": {
"input": {
"dtype": "float16",
"shape": [8],
"data": { "kind": "values", "values": [-4.0, -0.5, 0.0, 0.0, 0.5, 4.0, -2.0, 2.0] }
}
},
"outputs": { "output": { "dtype": "float16", "shape": [8], "tolerance": 0 } }
},
{
"name": "vec4_i32_lanes",
"inputs": {
"input": { "dtype": "int32", "shape": [8], "data": { "kind": "values", "values": [-5, -1, 0, 1, 5, -2, 2, 0] } }
},
"outputs": { "output": { "dtype": "int32", "shape": [8] } }
},
{
"name": "vec4_u32_lanes",
"inputs": {
"input": { "dtype": "uint32", "shape": [8], "data": { "kind": "values", "values": [0, 1, 2, 3, 4, 5, 0, 7] } }
},
"outputs": { "output": { "dtype": "uint32", "shape": [8] } }
},
{
"name": "vec4_i8_lanes",
"inputs": {
"input": {
"dtype": "int8",
"shape": [8],
"data": { "kind": "values", "values": [-128, -5, -1, 0, 1, 5, 100, 127] }
}
},
"outputs": { "output": { "dtype": "int8", "shape": [8] } }
},
{
"name": "vec4_u8_lanes",
"inputs": {
"input": {
"dtype": "uint8",
"shape": [8],
"data": { "kind": "values", "values": [0, 1, 2, 3, 128, 200, 254, 255] }
}
},
"outputs": { "output": { "dtype": "uint8", "shape": [8] } }
},
{
"name": "ort_float_nan_preserved",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/sign_test.cc",
"test": "MathOpTest.Sign_float",
"notes": "Extends the ORT float Sign coverage with ORT CPU-verified NaN preservation."
},
"inputs": {
"input": {
"dtype": "float32",
"shape": [4],
"data": { "kind": "values", "values": ["NaN", "-Infinity", 0.0, "Infinity"] }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [4], "tolerance": 0, "allowNaN": true } }
},
{
"name": "ort_float_nan_preserved_scalar",
"provenance": {
"source": "onnxruntime/test/providers/cpu/math/sign_test.cc",
"test": "MathOpTest.Sign_float",
"notes": "Scalar-path companion for ORT CPU-verified NaN preservation."
},
"inputs": {
"input": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": ["NaN", -2.0, 2.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [3], "tolerance": 0, "allowNaN": true } }
},
{
"name": "empty_input_zero_dim",
"inputs": { "input": { "dtype": "float32", "shape": [0], "data": { "kind": "values", "values": [] } } },
"outputs": { "output": { "dtype": "float32", "shape": [0], "tolerance": 0 } }
},
{
"name": "f32_rank0_scalar",
"inputs": { "input": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [-3.5] } } },
"outputs": { "output": { "dtype": "float32", "shape": [], "tolerance": 0 } }
},
{
"name": "f32_rank2_3x5",
"inputs": {
"input": {
"dtype": "float32",
"shape": [3, 5],
"data": {
"kind": "values",
"values": [-7.0, -0.5, 0.0, 0.5, 7.0, -1e-7, 1e-7, -100.0, 100.0, 0.0, -2.0, -1.0, 1.0, 2.0, 3.0]
}
}
},
"outputs": { "output": { "dtype": "float32", "shape": [3, 5], "tolerance": 0 } }
},
{
"name": "f16_rank2_realistic",
"inputs": {
"input": {
"dtype": "float16",
"shape": [4, 16],
"data": {
"kind": "values",
"values": [-8.0, -4.0, -2.0, -1.0, -0.5, -0.25, -0.125, -0.0625, 0.0, 0.0625, 0.125, 0.25, 0.5, 1.0, 2.0, 4.0, -7.5, -3.5, -1.5, -0.75, -0.375, -0.1875, -0.09375, -0.046875, 0.046875, 0.09375, 0.1875, 0.375, 0.75, 1.5, 3.5, 7.5, 0.0, 0.0, -6.0, 6.0, -5.0, 5.0, -3.0, 3.0, -2.5, 2.5, -1.25, 1.25, -0.625, 0.625, -0.3125, 0.3125, 8.0, -8.0, 4.0, -4.0, 2.0, -2.0, 1.0, -1.0, 0.5, -0.5, 0.25, -0.25, 0.125, -0.125, 0.0625, -0.0625]
}
}
},
"outputs": { "output": { "dtype": "float16", "shape": [4, 16], "tolerance": 0 } }
},
{
"name": "f16_nan_preserved_scalar_path",
"inputs": {
"input": {
"dtype": "float16",
"shape": [5],
"data": { "kind": "values", "values": ["NaN", -2.0, 0.0, 2.0, "NaN"] }
}
},
"outputs": { "output": { "dtype": "float16", "shape": [5], "tolerance": 0, "allowNaN": true } }
},
{
"name": "int8_min_value_sign_scalar_path",
"inputs": {
"input": { "dtype": "int8", "shape": [5], "data": { "kind": "values", "values": [-128, -1, 0, 1, 127] } }
},
"outputs": { "output": { "dtype": "int8", "shape": [5], "tolerance": 0 } }
},
{
"name": "f32_scalar_tail_4095",
"provenance": {
"notes": "Compact sibling for the large f32 Sign scalar-fallback benchmark; odd numel forces the elementwise path while preserving exact sign semantics."
},
"inputs": {
"input": {
"dtype": "float32",
"shape": [4095],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.027, "scale": 3.0 }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [4095], "tolerance": 0 } }
}
]
}