Xenova's picture
Xenova HF Staff
sync 2e7068faf55e
5ce7237 verified
Raw
History Blame
10.3 kB
{
"op": "com.microsoft.MRotaryEmbedding",
"fixtureArrays": {
"ort_sectioned_rank3_input_x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
},
"cases": [
{
"name": "rank4_odd_head_even_partial_rotation",
"provenance": {
"source": "onnxruntime/contrib_ops/cuda/bert/mrotary_embedding_impl.cu",
"notes": "The provider requires the effective rotary dimension, not the full head size, to be even. The singleton tail element is copied unchanged."
},
"attrs": {
"num_heads": 1,
"rotary_embedding_dim": 4,
"mrope_layout": 0,
"interleaved": 0,
"mrope_section": [1, 1, 0]
},
"inputs": {
"x": { "dtype": "float32", "shape": [1, 1, 2, 5], "data": { "kind": "linspace", "start": -1.25, "end": 1.5 } },
"positionIds": {
"dtype": "uint32",
"shape": [3, 1, 2],
"data": { "kind": "values", "values": [0, 1, 1, 2, 2, 0] }
},
"cos": { "dtype": "float32", "shape": [3, 2], "data": { "kind": "linspace", "start": 0.25, "end": 1.0 } },
"sin": { "dtype": "float32", "shape": [3, 2], "data": { "kind": "linspace", "start": -0.5, "end": 0.5 } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 2, 5], "tolerance": 0.00001 } }
},
{
"name": "ort_sectioned_rank3",
"provenance": {
"source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc",
"test": "ContribOpMRotaryEmbeddingTest.SectionedRank3",
"notes": "Pinned from ORT. Sectioned layout over three one-column sections, so each cache column is fed by a different position stream (T=[0,1], H=[1,2], W=[2,3]) and a stream mix-up changes every output."
},
"attrs": {
"num_heads": 2,
"rotary_embedding_dim": 6,
"mrope_layout": 0,
"interleaved": 0,
"scale": 1,
"mrope_section": [1, 1, 1]
},
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 12],
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_sectioned_rank3_input_x" } }
},
"positionIds": {
"dtype": "uint32",
"shape": [3, 1, 2],
"data": { "kind": "values", "values": [0, 1, 1, 2, 2, 3] }
},
"cos": {
"dtype": "float32",
"shape": [4, 3],
"data": { "kind": "values", "values": [1.0, 1.01, 1.02, 1.1, 1.11, 1.12, 1.2, 1.21, 1.22, 1.3, 1.31, 1.32] }
},
"sin": {
"dtype": "float32",
"shape": [4, 3],
"data": { "kind": "values", "values": [0.1, 0.11, 0.12, 0.15, 0.16, 0.17, 0.2, 0.21, 0.22, 0.25, 0.26, 0.27] }
}
},
"outputs": {
"y": {
"dtype": "float32",
"shape": [1, 2, 12],
"tolerance": 0.00001,
"data": {
"kind": "values",
"values": [0.6, 1.42, 2.34, 4.1, 5.87, 7.98, 6.0, 7.12, 8.34, 10.7, 13.49, 16.62, 11.9, 13.37, 14.94, 19.55, 23.51, 27.81, 17.6, 19.37, 21.24, 27.05, 32.03, 37.35]
}
}
}
},
{
"name": "ort_interleaved_rank4",
"provenance": {
"source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc",
"test": "ContribOpMRotaryEmbeddingTest.InterleavedRank4",
"notes": "Pinned from ORT. Interleaved mrope_layout together with interleaved rotation pairing and a non-unit scale, so the two independent 'interleaved' knobs and the scale are exercised at once."
},
"attrs": {
"num_heads": 2,
"rotary_embedding_dim": 6,
"mrope_layout": 1,
"interleaved": 1,
"scale": 0.5,
"mrope_section": [1, 1, 1]
},
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 6],
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_sectioned_rank3_input_x" } }
},
"positionIds": {
"dtype": "uint32",
"shape": [3, 1, 2],
"data": { "kind": "values", "values": [0, 1, 1, 2, 2, 3] }
},
"cos": {
"dtype": "float32",
"shape": [4, 3],
"data": { "kind": "values", "values": [1.0, 1.01, 1.02, 1.1, 1.11, 1.12, 1.2, 1.21, 1.22, 1.3, 1.31, 1.32] }
},
"sin": {
"dtype": "float32",
"shape": [4, 3],
"data": { "kind": "values", "values": [0.1, 0.11, 0.12, 0.15, 0.16, 0.17, 0.2, 0.21, 0.22, 0.25, 0.26, 0.27] }
}
},
"outputs": {
"y": {
"dtype": "float32",
"shape": [1, 2, 2, 6],
"tolerance": 0.00001,
"data": {
"kind": "values",
"values": [0.4, 1.05, 1.345, 2.46, 2.39, 4.21, 3.25, 4.925, 4.395, 6.995, 5.64, 9.405, 5.8, 7.65, 7.045, 10.08, 8.39, 12.85, 8.95, 12.425, 10.395, 15.515, 11.94, 18.945]
}
}
}
},
{
"name": "rank3_layout1_interleaved0",
"provenance": {
"notes": "Interleaved mrope_layout with the split (non-interleaved) rotation pairing — the layout/pairing knobs are independent, and this is the combination neither pinned case covers."
},
"attrs": {
"num_heads": 4,
"rotary_embedding_dim": 0,
"mrope_layout": 1,
"interleaved": 0,
"scale": 1,
"mrope_section": [2, 1, 1]
},
"inputs": {
"x": { "dtype": "float32", "shape": [2, 3, 32], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } },
"positionIds": {
"dtype": "uint32",
"shape": [3, 2, 3],
"data": { "kind": "values", "values": [0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7] }
},
"cos": { "dtype": "float32", "shape": [8, 4], "data": { "kind": "linspace", "start": -1.0, "end": 1.0 } },
"sin": { "dtype": "float32", "shape": [8, 4], "data": { "kind": "linspace", "start": 1.0, "end": -1.0 } }
},
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 32], "tolerance": 0.00001, "relTolerance": 0.00001 } }
},
{
"name": "rank4_layout0_partial_rotary_tail",
"provenance": {
"notes": "Sectioned layout with rotary_embedding_dim < head_size, so the lanes past the rotary window copy their tail values unchanged."
},
"attrs": {
"num_heads": 2,
"rotary_embedding_dim": 8,
"mrope_layout": 0,
"interleaved": 0,
"scale": 1,
"mrope_section": [1, 2, 1]
},
"inputs": {
"x": { "dtype": "float32", "shape": [1, 2, 4, 12], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } },
"positionIds": {
"dtype": "uint32",
"shape": [3, 1, 4],
"data": { "kind": "values", "values": [0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5] }
},
"cos": { "dtype": "float32", "shape": [6, 4], "data": { "kind": "linspace", "start": -1.0, "end": 1.0 } },
"sin": { "dtype": "float32", "shape": [6, 4], "data": { "kind": "linspace", "start": 1.0, "end": -1.0 } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 4, 12], "tolerance": 0.00001, "relTolerance": 0.00001 } }
},
{
"name": "rank3_text_only_streams_collapse",
"provenance": {
"notes": "Text-only tokens set T == H == W, which ORT documents as reducing M-RoPE to standard RoPE; the section split must then become unobservable."
},
"attrs": { "num_heads": 2, "mrope_section": [2, 1, 1] },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 4, 16], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } },
"positionIds": {
"dtype": "uint32",
"shape": [3, 1, 4],
"data": { "kind": "values", "values": [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3] }
},
"cos": { "dtype": "float32", "shape": [8, 4], "data": { "kind": "linspace", "start": -1.0, "end": 1.0 } },
"sin": { "dtype": "float32", "shape": [8, 4], "data": { "kind": "linspace", "start": 1.0, "end": -1.0 } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 4, 16], "tolerance": 0.00001, "relTolerance": 0.00001 } }
},
{
"name": "f16_rank4_layout1_interleaved",
"provenance": {
"notes": "f16 storage, including the provider's T-rounded scaled-cache intermediate, on the interleaved layout and pairing."
},
"attrs": {
"rotary_embedding_dim": 0,
"mrope_layout": 1,
"interleaved": 1,
"scale": 0.3,
"mrope_section": [2, 2, 2]
},
"inputs": {
"x": { "dtype": "float16", "shape": [1, 2, 3, 12], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } },
"positionIds": {
"dtype": "uint32",
"shape": [3, 1, 3],
"data": { "kind": "values", "values": [0, 1, 2, 1, 2, 3, 2, 3, 4] }
},
"cos": { "dtype": "float16", "shape": [6, 6], "data": { "kind": "linspace", "start": -1.0, "end": 1.0 } },
"sin": { "dtype": "float16", "shape": [6, 6], "data": { "kind": "linspace", "start": 1.0, "end": -1.0 } }
},
"outputs": { "y": { "dtype": "float16", "shape": [1, 2, 3, 12], "tolerance": 0.01, "relTolerance": 0.01 } }
},
{
"name": "rank3_scale_half_sectioned",
"provenance": { "notes": "Non-unit scale on the sectioned layout; scale multiplies both gathered cos and sin." },
"attrs": {
"num_heads": 2,
"rotary_embedding_dim": 0,
"mrope_layout": 0,
"interleaved": 0,
"scale": 0.5,
"mrope_section": [1, 1, 2]
},
"inputs": {
"x": { "dtype": "float32", "shape": [2, 2, 16], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } },
"positionIds": {
"dtype": "uint32",
"shape": [3, 2, 2],
"data": { "kind": "values", "values": [0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 0, 1] }
},
"cos": { "dtype": "float32", "shape": [5, 4], "data": { "kind": "linspace", "start": -1.0, "end": 1.0 } },
"sin": { "dtype": "float32", "shape": [5, 4], "data": { "kind": "linspace", "start": 1.0, "end": -1.0 } }
},
"outputs": { "y": { "dtype": "float32", "shape": [2, 2, 16], "tolerance": 0.00001, "relTolerance": 0.00001 } }
}
]
}