OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[Opset] Opset16 initialization (#27458)
Piotr Krzemiński704de6e74443
diff --git a/docs/sphinx_setup/api/ie_python_api/api.rst b/docs/sphinx_setup/api/ie_python_api/api.rstindex efbe25ee40b..6fc754da124 100644--- a/docs/sphinx_setup/api/ie_python_api/api.rst+++ b/docs/sphinx_setup/api/ie_python_api/api.rst@@ -119,6 +119,12 @@ OpenVINO Python APIopenvino.runtime.opset15+.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.runtime.opset16+.. autosummary:::toctree: _autosummary:template: custom-module-template.rstdiff --git a/src/bindings/python/src/openvino/runtime/opset16/__init__.py b/src/bindings/python/src/openvino/runtime/opset16/__init__.pynew file mode 100644index 00000000000..bf155b81312--- /dev/null+++ b/src/bindings/python/src/openvino/runtime/opset16/__init__.py@@ -0,0 +1,8 @@+# -*- coding: utf-8 -*-+# Copyright (C) 2018-2024 Intel Corporation+# SPDX-License-Identifier: Apache-2.0++# New operations added in Opset16++# Operators from previous opsets+# TODO (ticket: 156877): Add previous opset operators at the end of opset16 developmentdiff --git a/src/bindings/python/src/openvino/runtime/opset16/ops.py b/src/bindings/python/src/openvino/runtime/opset16/ops.pynew file mode 100644index 00000000000..0825ccb9d0f--- /dev/null+++ b/src/bindings/python/src/openvino/runtime/opset16/ops.py@@ -0,0 +1,12 @@+# -*- coding: utf-8 -*-+# Copyright (C) 2018-2024 Intel Corporation+# SPDX-License-Identifier: Apache-2.0++"""Factory functions for ops added to openvino opset16."""+from functools import partial++from openvino.runtime.opset_utils import _get_node_factory++_get_node_factory_opset16 = partial(_get_node_factory, "opset16")++# -------------------------------------------- ops ------------------------------------------------diff --git a/src/bindings/python/tests/test_transformations/test_pattern_ops.py b/src/bindings/python/tests/test_transformations/test_pattern_ops.pyindex 041bf83764e..24b28061582 100644--- a/src/bindings/python/tests/test_transformations/test_pattern_ops.py+++ b/src/bindings/python/tests/test_transformations/test_pattern_ops.py@@ -189,7 +189,7 @@ def test_pattern_optional_root():def test_wrap_type_pattern_type():- last_opset_number = 15+ last_opset_number = 16for i in range(1, last_opset_number + 1):WrapType(f"opset{i}.Parameter")WrapType(f"opset{i}::Parameter")diff --git a/src/core/include/openvino/opsets/opset.hpp b/src/core/include/openvino/opsets/opset.hppindex 7ab8c43fcec..524729793f0 100644--- a/src/core/include/openvino/opsets/opset.hpp+++ b/src/core/include/openvino/opsets/opset.hpp@@ -172,6 +172,11 @@ const OPENVINO_API OpSet& get_opset14();* @ingroup ov_opset_cpp_api*/const OPENVINO_API OpSet& get_opset15();+/**+ * @brief Returns map of available opsets+ * @ingroup ov_opset_cpp_api+ */+const OPENVINO_API OpSet& get_opset16();/*** @brief Returns map of available opsets* @ingroup ov_opset_cpp_apidiff --git a/src/core/include/openvino/opsets/opset16.hpp b/src/core/include/openvino/opsets/opset16.hppnew file mode 100644index 00000000000..0e2c6c5452f--- /dev/null+++ b/src/core/include/openvino/opsets/opset16.hpp@@ -0,0 +1,15 @@+// Copyright (C) 2018-2024 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include "openvino/op/ops.hpp"++namespace ov {+namespace opset16 {+#define _OPENVINO_OP_REG(a, b) using b::a;+#include "openvino/opsets/opset16_tbl.hpp"+#undef _OPENVINO_OP_REG+} // namespace opset16+} // namespace ovdiff --git a/src/core/include/openvino/opsets/opset16_tbl.hpp b/src/core/include/openvino/opsets/opset16_tbl.hppnew file mode 100644index 00000000000..82aa9629263--- /dev/null+++ b/src/core/include/openvino/opsets/opset16_tbl.hpp@@ -0,0 +1,16 @@+// Copyright (C) 2018-2024 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#ifndef _OPENVINO_OP_REG+# warning "_OPENVINO_OP_REG not defined"+# define _OPENVINO_OP_REG(x, y)+#endif++// Previous opsets operators+// TODO (ticket: 156877): Add remaining operators from opset15 at the end of opset16 development+_OPENVINO_OP_REG(Parameter, ov::op::v0)+_OPENVINO_OP_REG(Convert, ov::op::v0)+_OPENVINO_OP_REG(ShapeOf, ov::op::v3)++// New operations added in opset16diff --git a/src/core/src/opsets/opset.cpp b/src/core/src/opsets/opset.cppindex ca219f1c68e..f2490010e9d 100644--- a/src/core/src/opsets/opset.cpp+++ b/src/core/src/opsets/opset.cpp@@ -113,7 +113,8 @@ const std::map<std::string, std::function<const ov::OpSet&()>>& ov::get_availabl_OPENVINO_REG_OPSET(opset12),_OPENVINO_REG_OPSET(opset13),_OPENVINO_REG_OPSET(opset14),- _OPENVINO_REG_OPSET(opset15)};+ _OPENVINO_REG_OPSET(opset15),+ _OPENVINO_REG_OPSET(opset16)};#undef _OPENVINO_REG_OPSETreturn opset_map;}@@ -288,3 +289,14 @@ const ov::OpSet& ov::get_opset15() {});return opset;}++const ov::OpSet& ov::get_opset16() {+ static OpSet opset;+ static std::once_flag flag;+ std::call_once(flag, [&]() {+#define _OPENVINO_OP_REG(NAME, NAMESPACE) opset.insert<NAMESPACE::NAME>();+#include "openvino/opsets/opset16_tbl.hpp"+#undef _OPENVINO_OP_REG+ });+ return opset;+}diff --git a/src/core/tests/op.cpp b/src/core/tests/op.cppindex cf65eecc16c..08fa7a97584 100644--- a/src/core/tests/op.cpp+++ b/src/core/tests/op.cpp@@ -67,4 +67,5 @@ TEST(op, opset_multi_thread) {doTest(ov::get_opset13);doTest(ov::get_opset14);doTest(ov::get_opset15);+ doTest(ov::get_opset16);}diff --git a/src/core/tests/opset.cpp b/src/core/tests/opset.cppindex 65c79dc9432..d667de21263 100644--- a/src/core/tests/opset.cpp+++ b/src/core/tests/opset.cpp@@ -14,6 +14,7 @@#include "openvino/opsets/opset13.hpp"#include "openvino/opsets/opset14.hpp"#include "openvino/opsets/opset15.hpp"+#include "openvino/opsets/opset16.hpp"#include "openvino/opsets/opset2.hpp"#include "openvino/opsets/opset3.hpp"#include "openvino/opsets/opset4.hpp"@@ -75,7 +76,8 @@ INSTANTIATE_TEST_SUITE_P(opset,OpsetTestParams{ov::get_opset12, 178},OpsetTestParams{ov::get_opset13, 186},OpsetTestParams{ov::get_opset14, 188},- OpsetTestParams{ov::get_opset15, 199}),+ OpsetTestParams{ov::get_opset15, 199},+ OpsetTestParams{ov::get_opset16, 3}),OpsetTestNameGenerator{});class MyOpOld : public ov::op::Op {diff --git a/src/frontends/common/include/openvino/frontend/extension/op.hpp b/src/frontends/common/include/openvino/frontend/extension/op.hppindex 55fa9194474..9022b9f801f 100644--- a/src/frontends/common/include/openvino/frontend/extension/op.hpp+++ b/src/frontends/common/include/openvino/frontend/extension/op.hpp@@ -25,7 +25,7 @@ inline const ov::OpSet& get_opset_by_name(const std::string& opset_name) {if (opsets.find(opset_name) != opsets.end())return opsets.at(opset_name)();if (opset_name.empty() || opset_name == "latest") {- return ov::get_opset15();+ return ov::get_opset15(); // TODO (ticket: 156877): Update to 16 at the end of opset16 development} else {FRONT_END_GENERAL_CHECK(false, "Unsupported opset name: ", opset_name);}diff --git a/src/plugins/template/src/plugin.cpp b/src/plugins/template/src/plugin.cppindex ee885f67e18..f66df99c7b1 100644--- a/src/plugins/template/src/plugin.cpp+++ b/src/plugins/template/src/plugin.cpp@@ -221,6 +221,7 @@ ov::SupportedOpsMap ov::template_plugin::Plugin::query_model(const std::shared_p#include "openvino/opsets/opset13_tbl.hpp"#include "openvino/opsets/opset14_tbl.hpp"#include "openvino/opsets/opset15_tbl.hpp"+#include "openvino/opsets/opset16_tbl.hpp"// clang-format on#undef _OPENVINO_OP_REGreturn op_super_set.contains_type(node->get_type_info());diff --git a/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/op_impl_check/single_op_graph.cpp b/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/op_impl_check/single_op_graph.cppindex fb192e0ac40..e311f532a24 100644--- a/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/op_impl_check/single_op_graph.cpp+++ b/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/op_impl_check/single_op_graph.cpp@@ -2189,6 +2189,7 @@ OpGenerator getOpGeneratorMap() {#include "openvino/opsets/opset13_tbl.hpp"#include "openvino/opsets/opset14_tbl.hpp"#include "openvino/opsets/opset15_tbl.hpp"+#include "openvino/opsets/opset16_tbl.hpp"#undef _OPENVINO_OP_REG};return opGeneratorMap;