Skip to content

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

[Docs] Apply OpenVINO RTTI in Docs (#28453)

Tomasz Jankowskia3e59b78625c
diff --git a/docs/articles_en/assets/snippets/lpt_intel_cpu_plugin.cpp b/docs/articles_en/assets/snippets/lpt_intel_cpu_plugin.cpp
index 76e6d60b8e3..b76a2595b8f 100644
--- a/docs/articles_en/assets/snippets/lpt_intel_cpu_plugin.cpp
+++ b/docs/articles_en/assets/snippets/lpt_intel_cpu_plugin.cpp
@@ -18,6 +18,7 @@ namespace device {
class ConvertOpSet1ToDeviceSpecific: public ov::pass::ModelPass {
public:
+ OPENVINO_MODEL_PASS_RTTI("ConvertOpSet1ToDeviceSpecific");
bool run_on_model(const std::shared_ptr<ov::Model>& f) override {
return true;
}
@@ -96,7 +97,7 @@ if (useLpt) {
// Low precision transformations plugin specific configuration: transformation callbacks definition
lptManager.get_pass_config()->set_callback<MarkupPrecisions>([](const std::shared_ptr<const ov::Node>& node) -> bool {
- if (const auto multiply = std::dynamic_pointer_cast<const ov::opset1::Multiply>(node)) {
+ if (const auto multiply = ov::as_type_ptr<const ov::opset1::Multiply>(node)) {
return !MultiplyToGroupConvolutionTransformation::canBeTransformedToGroupConvolution(multiply);
}
return false;
diff --git a/docs/articles_en/assets/snippets/ov_model_snippets.cpp b/docs/articles_en/assets/snippets/ov_model_snippets.cpp
index 31ba0bc8028..b9c9a1155cc 100644
--- a/docs/articles_en/assets/snippets/ov_model_snippets.cpp
+++ b/docs/articles_en/assets/snippets/ov_model_snippets.cpp
@@ -217,7 +217,7 @@ return true;
// ! [ov:replace_node]
bool ov_replace_node(std::shared_ptr<ov::Node> node) {
// Step 1. Verify that node is of type ov::op::v0::Negative
- auto neg = std::dynamic_pointer_cast<ov::op::v0::Negative>(node);
+ auto neg = ov::as_type_ptr<ov::op::v0::Negative>(node);
if (!neg) {
return false;
}
@@ -238,7 +238,7 @@ bool ov_replace_node(std::shared_ptr<ov::Node> node) {
// ! [ov:replace_node]
bool ov_manual_replace_node(std::shared_ptr<ov::Node> node) {
-auto neg = std::dynamic_pointer_cast<ov::op::v0::Negative>(node);
+auto neg = ov::as_type_ptr<ov::op::v0::Negative>(node);
if (!neg) {
return false;
}
diff --git a/docs/articles_en/assets/snippets/ov_stateful_models_intro.cpp b/docs/articles_en/assets/snippets/ov_stateful_models_intro.cpp
index 01170795dbe..a5271d14819 100644
--- a/docs/articles_en/assets/snippets/ov_stateful_models_intro.cpp
+++ b/docs/articles_en/assets/snippets/ov_stateful_models_intro.cpp
@@ -99,7 +99,7 @@ void replace_non_reshapable_const() {
for (const auto& node : model->get_ops()) {
// Trying to find the problematic Constant by name.
if (node->get_friendly_name() == "name_of_non_reshapable_const") {
- auto const_with_hardcoded_shape = std::dynamic_pointer_cast<ov::opset8::Constant>(node);
+ auto const_with_hardcoded_shape = ov::as_type_ptr<ov::opset8::Constant>(node);
// Replacing the problematic Constant with a new one. Do this for all the problematic Constants in the network, then
// you can apply the reshape feature.
ov::replace_node(const_with_hardcoded_shape, new_const);
diff --git a/docs/articles_en/assets/snippets/template_model_transformation.hpp b/docs/articles_en/assets/snippets/template_model_transformation.hpp
index de615f54acf..9eab5e3ac6f 100644
--- a/docs/articles_en/assets/snippets/template_model_transformation.hpp
+++ b/docs/articles_en/assets/snippets/template_model_transformation.hpp
@@ -18,7 +18,7 @@ class MyModelTransformation;
// template_model_transformation.hpp
class ov::pass::MyModelTransformation : public ov::pass::ModelPass {
public:
- OPENVINO_RTTI("MyModelTransformation", "0");
+ OPENVINO_MODEL_PASS_RTTI("MyModelTransformation");
bool run_on_model(const std::shared_ptr<ov::Model>& f) override;
};
// ! [model_pass:template_transformation_hpp]
diff --git a/docs/articles_en/assets/snippets/template_pattern_transformation.cpp b/docs/articles_en/assets/snippets/template_pattern_transformation.cpp
index 408f7f72d94..e7c6d7889e8 100644
--- a/docs/articles_en/assets/snippets/template_pattern_transformation.cpp
+++ b/docs/articles_en/assets/snippets/template_pattern_transformation.cpp
@@ -23,7 +23,7 @@ ov::pass::DecomposeDivideMatcher::DecomposeDivideMatcher() {
auto div = std::make_shared<ov::opset3::Divide>(input0, input1);
ov::matcher_pass_callback callback = [](pattern::Matcher& m) {
- auto div = std::dynamic_pointer_cast<ov::opset3::Divide>(m.get_match_root());
+ auto div = ov::as_type_ptr<ov::opset3::Divide>(m.get_match_root());
// We can not apply this transformation in case with integer input data type
if (!div || div->input(0).get_element_type().is_integral()) {
return false;
diff --git a/docs/articles_en/assets/snippets/template_pattern_transformation.hpp b/docs/articles_en/assets/snippets/template_pattern_transformation.hpp
index e6e1fd27146..2ec754c6161 100644
--- a/docs/articles_en/assets/snippets/template_pattern_transformation.hpp
+++ b/docs/articles_en/assets/snippets/template_pattern_transformation.hpp
@@ -23,13 +23,13 @@ class ReluReluFusionMatcher;
*/
class ov::pass::DecomposeDivideMatcher : public ov::pass::MatcherPass {
public:
- OPENVINO_RTTI("DecomposeDivideMatcher", "0");
+ OPENVINO_MATCHER_PASS_RTTI("DecomposeDivideMatcher");
DecomposeDivideMatcher();
};
// ! [graph_rewrite:template_transformation_hpp]
class ov::pass::ReluReluFusionMatcher : public ov::pass::MatcherPass {
public:
- OPENVINO_RTTI("ReluReluFusionMatcher", "0");
+ OPENVINO_MATCHER_PASS_RTTI("ReluReluFusionMatcher");
ReluReluFusionMatcher();
};