| { |
| "op": "ai.onnx.SimplifiedLayerNormalization", |
| "fixtureArrays": { |
| "f16_scalar_cast_x": [-1.1103515625, 2.982421875, 1.248046875, -1.8544921875], |
| "f16_scalar_cast_scale": [2.015625], |
| "f16_scalar_cast_y": [-1.1513671875, 3.091796875, 1.2939453125, -1.921875] |
| }, |
| "cases": [ |
| { |
| "name": "legacy_last_axis_vec4_no_stats_2x8", |
| "attrs": { "epsilon": 0.000001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2, 8], |
| "data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.07 } |
| }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [8], |
| "data": { "kind": "fillFloat32", "sinStep": 0.23, "cosStep": 0.19, "scale": 0.5 } |
| } |
| }, |
| "outputs": { "y": { "dtype": "float32", "shape": [2, 8], "tolerance": 0.000002 } } |
| }, |
| { |
| "name": "legacy_last_axis_scalar_no_stats_2x5", |
| "attrs": { "epsilon": 0.000001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2, 5], |
| "data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.07 } |
| }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [5], |
| "data": { "kind": "fillFloat32", "sinStep": 0.23, "cosStep": 0.19, "scale": 0.5 } |
| } |
| }, |
| "outputs": { "y": { "dtype": "float32", "shape": [2, 5], "tolerance": 0.000002 } } |
| }, |
| { |
| "name": "legacy_last_axis_vec4_stats_2x8", |
| "attrs": { "epsilon": 0.00001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2, 8], |
| "data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.21 } |
| }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [8], |
| "data": { "kind": "fillFloat32", "sinStep": 0.29, "cosStep": 0.11, "scale": 0.5 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "float32", "shape": [2, 8], "tolerance": 0.000002 }, |
| "invStdVar": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.00001 } |
| } |
| }, |
| { |
| "name": "legacy_last_axis_scalar_stats_2x33", |
| "attrs": { "epsilon": 0.00001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2, 33], |
| "data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.27 } |
| }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [33], |
| "data": { "kind": "fillFloat32", "sinStep": 0.21, "cosStep": 0.13, "scale": 0.5 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "float32", "shape": [2, 33], "tolerance": 0.000002 }, |
| "invStdVar": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.00001 } |
| } |
| }, |
| { |
| "name": "legacy_scalar_scale_generic_stats_2x8", |
| "attrs": { "epsilon": 0.00001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2, 8], |
| "data": { "kind": "fillFloat32", "sinStep": 0.31, "cosStep": 0.09 } |
| }, |
| "scale": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [0.75] } } |
| }, |
| "outputs": { |
| "y": { "dtype": "float32", "shape": [2, 8], "tolerance": 0.000002 }, |
| "invStdVar": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.00001 } |
| } |
| }, |
| { |
| "name": "legacy_suffix_axis1_stats_2x3x4", |
| "attrs": { "epsilon": 0.00001, "axis": 1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2, 3, 4], |
| "data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.23 } |
| }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [3, 4], |
| "data": { "kind": "fillFloat32", "sinStep": 0.07, "cosStep": 0.29, "scale": 0.5 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "float32", "shape": [2, 3, 4], "tolerance": 0.000002 }, |
| "invStdVar": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.00001 } |
| } |
| }, |
| { |
| "name": "legacy_mixed_f16_x_f32_scale_stats_2x4", |
| "attrs": { "epsilon": 0.00001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float16", |
| "shape": [2, 4], |
| "data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.21 } |
| }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [4], |
| "data": { "kind": "fillFloat32", "sinStep": 0.29, "cosStep": 0.11, "scale": 0.5 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.002 }, |
| "invStdVar": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.002 } |
| } |
| }, |
| { |
| "name": "legacy_mixed_f32_x_f16_scale_2x4", |
| "attrs": { "epsilon": 0.00001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2, 4], |
| "data": { "kind": "fillFloat32", "sinStep": 0.15, "cosStep": 0.25 } |
| }, |
| "scale": { |
| "dtype": "float16", |
| "shape": [4], |
| "data": { "kind": "fillFloat32", "sinStep": 0.27, "cosStep": 0.09, "scale": 0.5 } |
| } |
| }, |
| "outputs": { "y": { "dtype": "float16", "shape": [2, 4], "tolerance": 0.003 } } |
| }, |
| { |
| "name": "legacy_f16_vec4_stats_4x32", |
| "attrs": { "epsilon": 0.00001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float16", |
| "shape": [4, 32], |
| "data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.27 } |
| }, |
| "scale": { |
| "dtype": "float16", |
| "shape": [32], |
| "data": { "kind": "fillFloat32", "sinStep": 0.21, "cosStep": 0.13, "scale": 0.5 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "float16", "shape": [4, 32], "tolerance": 0.005 }, |
| "invStdVar": { "dtype": "float32", "shape": [4, 1], "tolerance": 0.002 } |
| } |
| }, |
| { |
| "name": "legacy_suffix_splitk_stats_2x64x512", |
| "attrs": { "epsilon": 0.00001, "axis": 1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2, 64, 512], |
| "data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.017 } |
| }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [64, 512], |
| "data": { "kind": "fillFloat32", "sinStep": 0.011, "cosStep": 0.007, "scale": 0.5 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "float32", "shape": [2, 64, 512], "tolerance": 0.00001 }, |
| "invStdVar": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.00001 } |
| } |
| }, |
| { |
| "name": "legacy_suffix_splitk_no_stats_1x32x512", |
| "attrs": { "epsilon": 0.00001, "axis": 1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [1, 32, 512], |
| "data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.023 } |
| }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [32, 512], |
| "data": { "kind": "fillFloat32", "sinStep": 0.009, "cosStep": 0.019, "scale": 0.5 } |
| } |
| }, |
| "outputs": { "y": { "dtype": "float32", "shape": [1, 32, 512], "tolerance": 0.00001 } } |
| }, |
| { |
| "name": "legacy_suffix_splitk_scalar_scale_no_stats_1x32x512", |
| "attrs": { "epsilon": 0.00001, "axis": 1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [1, 32, 512], |
| "data": { "kind": "fillFloat32", "sinStep": 0.019, "cosStep": 0.013 } |
| }, |
| "scale": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [0.75] } } |
| }, |
| "outputs": { "y": { "dtype": "float32", "shape": [1, 32, 512], "tolerance": 0.00001 } } |
| }, |
| { |
| "name": "legacy_f16_scale_before_output_cast_vec4_exact", |
| "provenance": { |
| "source": "onnxruntime/core/providers/cpu/nn/layer_norm_impl.cc", |
| "test": "SimplifiedLayerNormalization legacy f16 cast boundary", |
| "notes": "The legacy op applies scale before its single output cast. The first value differs by one f16 ULP from standardized RMSNormalization, which casts the normalized stage before scale." |
| }, |
| "requires": { "features": ["shader-f16"] }, |
| "attrs": { "epsilon": 0.00001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float16", |
| "shape": [1, 4], |
| "data": { "kind": "values", "values": [-1.4765625, -1.861328125, 1.4697265625, 1.0703125] } |
| }, |
| "scale": { |
| "dtype": "float16", |
| "shape": [4], |
| "data": { "kind": "values", "values": [0.316162109375, -2.791015625, -0.0877685546875, 2.0859375] } |
| } |
| }, |
| "outputs": { |
| "y": { |
| "dtype": "float16", |
| "shape": [1, 4], |
| "tolerance": 0, |
| "relTolerance": 0, |
| "data": { "kind": "values", "values": [-0.31201171875, 3.47265625, -0.08624267578125, 1.4921875] } |
| } |
| } |
| }, |
| { |
| "name": "legacy_f16_scale_before_output_cast_generic_exact", |
| "provenance": { |
| "source": "onnxruntime/core/providers/cpu/nn/layer_norm_impl.cc", |
| "test": "SimplifiedLayerNormalization scalar-scale cast boundary", |
| "notes": "A scalar scale forces the generic shared template and pins the same legacy cast ordering independently of the optimized row path." |
| }, |
| "requires": { "features": ["shader-f16"] }, |
| "attrs": { "epsilon": 0.00001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float16", |
| "shape": [1, 4], |
| "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_x" } } |
| }, |
| "scale": { |
| "dtype": "float16", |
| "shape": [], |
| "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_scale" } } |
| } |
| }, |
| "outputs": { |
| "y": { |
| "dtype": "float16", |
| "shape": [1, 4], |
| "tolerance": 0, |
| "relTolerance": 0, |
| "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_y" } } |
| } |
| } |
| }, |
| { |
| "name": "legacy_f16_scale_before_output_cast_splitk_exact", |
| "provenance": { |
| "source": "onnxruntime/core/providers/cpu/nn/layer_norm_impl.cc", |
| "test": "SimplifiedLayerNormalization split-K f16 cast boundary", |
| "notes": "Forces the split-K shared kernel on the exact scalar-scale boundary and pins the legacy scale-before-output-cast ordering." |
| }, |
| "requires": { "features": ["shader-f16"] }, |
| "tunables": { "SPLIT_MIN_HIDDEN": 1, "SPLIT_TARGET_ELEMENTS": 1 }, |
| "attrs": { "epsilon": 0.00001, "axis": -1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float16", |
| "shape": [1, 4], |
| "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_x" } } |
| }, |
| "scale": { |
| "dtype": "float16", |
| "shape": [], |
| "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_scale" } } |
| } |
| }, |
| "outputs": { |
| "y": { |
| "dtype": "float16", |
| "shape": [1, 4], |
| "tolerance": 0, |
| "relTolerance": 0, |
| "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_y" } } |
| } |
| } |
| }, |
| { |
| "name": "legacy_rank1_default_attrs_8", |
| "attrs": {}, |
| "inputs": { |
| "x": { "dtype": "float32", "shape": [8], "data": { "kind": "fillFloat32", "sinStep": 0.37, "cosStep": 0.03 } }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [8], |
| "data": { "kind": "fillFloat32", "sinStep": 0.05, "cosStep": 0.41, "scale": 0.5 } |
| } |
| }, |
| "outputs": { "y": { "dtype": "float32", "shape": [8], "tolerance": 0.000002 } } |
| }, |
| { |
| "name": "legacy_explicit_stash_type_float32", |
| "attrs": { "epsilon": 0.00001, "axis": -1, "stash_type": 1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2, 8], |
| "data": { "kind": "fillFloat32", "sinStep": 0.29, "cosStep": 0.13 } |
| }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [8], |
| "data": { "kind": "fillFloat32", "sinStep": 0.07, "cosStep": 0.37, "scale": 0.5 } |
| } |
| }, |
| "outputs": { "y": { "dtype": "float32", "shape": [2, 8], "tolerance": 0.000002 } } |
| }, |
| { |
| "name": "legacy_keep_dims_compatibility_attribute", |
| "provenance": { |
| "source": "onnxruntime/test/contrib_ops/layer_norm_test.cc", |
| "test": "SimplifiedLayerNormalization keep_dims=1", |
| "notes": "ONNX Runtime's legacy schema permits unchecked attributes and its own compatibility test emits keep_dims=1. The kernel ignores the attribute and always retains reduced dimensions for optional statistics." |
| }, |
| "attrs": { "epsilon": 0.00001, "axis": 1, "keep_dims": 1 }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2, 3, 4], |
| "data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31 } |
| }, |
| "scale": { |
| "dtype": "float32", |
| "shape": [3, 4], |
| "data": { "kind": "fillFloat32", "sinStep": 0.23, "cosStep": 0.09, "scale": 0.5 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "float32", "shape": [2, 3, 4], "tolerance": 0.000002 }, |
| "invStdVar": { "dtype": "float32", "shape": [2, 1, 1], "tolerance": 0.00001 } |
| } |
| }, |
| { |
| "name": "legacy_zero_outer_rows_stats", |
| "attrs": { "epsilon": 0.00001, "axis": -1 }, |
| "inputs": { |
| "x": { "dtype": "float32", "shape": [0, 4], "data": { "kind": "values", "values": [] } }, |
| "scale": { "dtype": "float32", "shape": [4], "data": { "kind": "constant", "value": 1.0 } } |
| }, |
| "outputs": { |
| "y": { "dtype": "float32", "shape": [0, 4], "tolerance": 0.000002 }, |
| "invStdVar": { "dtype": "float32", "shape": [0, 1], "tolerance": 0.00001 } |
| } |
| } |
| ] |
| } |
|
|