Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[ONNX] Enable Cross-Domain Compatibility for "SimplifiedLayerNormalization" (#29878)

Xian Fu, Wong883cf24fa8a5
diff --git a/src/frontends/onnx/docs/supported_ops.md b/src/frontends/onnx/docs/supported_ops.md
index 7031a2dc0c6..41ca6785528 100644
--- a/src/frontends/onnx/docs/supported_ops.md
+++ b/src/frontends/onnx/docs/supported_ops.md
@@ -301,7 +301,7 @@ OpenVINO provides support for operations of Default Opset (empty in table below)
|com.microsoft |RotaryEmbedding | |1 | |
|com.microsoft |SampleOp | |1 | |
|com.microsoft |Sampling | |1 | |
-|com.microsoft |SimplifiedLayerNormalization | |1 | |
+|com.microsoft |SimplifiedLayerNormalization |1 |1 | |
|com.microsoft |SkipGroupNorm | |1 | |
|com.microsoft |SkipLayerNormalization |1 |1 | |
|com.microsoft |SkipSimplifiedLayerNormalization |1 |1 | |
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/simplified_layer_normalization.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/simplified_layer_normalization.cpp
index 7d65e34a0dc..b8ef3f31c42 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/simplified_layer_normalization.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/simplified_layer_normalization.cpp
@@ -80,6 +80,18 @@ ov::OutputVector simplified_layer_normalization(const ov::frontend::onnx::Node&
ONNX_OP("SimplifiedLayerNormalization", OPSET_SINCE(1), ai_onnx::opset_1::simplified_layer_normalization);
} // namespace opset_1
} // namespace ai_onnx
+
+namespace com_microsoft {
+namespace opset_1 {
+OPENVINO_DEPRECATED("'SimplifiedLayerNormalization' in the 'com_microsoft' domain is deprecated. Please use the "
+ "'ai_onnx' domain instead, which is adopted by ONNX Runtime Web.")
+ONNX_OP("SimplifiedLayerNormalization",
+ OPSET_SINCE(1),
+ ai_onnx::opset_1::simplified_layer_normalization,
+ MICROSOFT_DOMAIN);
+} // namespace opset_1
+} // namespace com_microsoft
+
} // namespace onnx
} // namespace frontend
} // namespace ov
diff --git a/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp b/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp
index 22a8cd03feb..88c47e764e4 100644
--- a/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp
+++ b/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp
@@ -1444,6 +1444,36 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_skip_simplified_layer_normalization) {
test_case.run();
}
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_simplified_layer_normalization) {
+ const auto model = convert_model("com.microsoft/simplified_layer_normalization.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ const std::vector<float> input =
+ {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f, 12.f, 13.f, 14.f, 15.f, 16.f};
+
+ const std::vector<float> expected_output = {0.19802947f,
+ 0.39605895f,
+ 0.59408844f,
+ 0.7921179f,
+ 0.9901474f,
+ 1.1881769f,
+ 1.3862064f,
+ 1.5842358f,
+ 0.7082005f,
+ 0.78688943f,
+ 0.8655784f,
+ 0.94426733f,
+ 1.0229563f,
+ 1.1016452f,
+ 1.1803342f,
+ 1.2590232f};
+
+ test_case.add_input<float>(Shape{2, 8}, input);
+ test_case.add_expected_output<float>(Shape{2, 8}, expected_output);
+
+ test_case.run();
+}
+
OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_simplified_layer_normalization_2x2x8) {
const auto model = convert_model("com.microsoft/simplified_layer_normalization_2x2x8.onnx");
auto test_case = ov::test::TestCase(model, s_device);