From 9391f0aba535951b2dee3c6861a4f4f3beec183d Mon Sep 17 00:00:00 2001 From: Ilya Churaev Date: Thu, 4 Mar 2021 07:24:55 +0300 Subject: [PATCH 1/2] Updated nGraph custom op documentation --- docs/IE_DG/Extensibility_DG/AddingNGraphOps.md | 2 +- docs/template_extension/op.cpp | 4 ++-- docs/template_extension/op.hpp | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/IE_DG/Extensibility_DG/AddingNGraphOps.md b/docs/IE_DG/Extensibility_DG/AddingNGraphOps.md index 9717b08f1c427d..ed0c0aad75d34d 100644 --- a/docs/IE_DG/Extensibility_DG/AddingNGraphOps.md +++ b/docs/IE_DG/Extensibility_DG/AddingNGraphOps.md @@ -6,7 +6,7 @@ Inference Engine Extension API allows to register operation sets (opsets) with c To add your custom nGraph operation, create a new class that extends `ngraph::Op`, which is in turn derived from `ngraph::Node`, the base class for all graph operations in nGraph. Follow the steps below: -1. Define a `NodeTypeInfo` object that identifies the type of the operation to the graph users and helps with dynamic type resolution. The type info of an nGraph operation currently consists of a string identifier and a version number, but this may change in the future. +1. Add the `NGRAPH_RTTI_DECLARATION` and `NGRAPH_RTTI_DEFINITION` macros that define a `NodeTypeInfo` object that identifies the type of the operation to the graph users and helps with dynamic type resolution. The type info of an nGraph operation currently consists of a string identifier and a version number, but this may change in the future. 2. Implement constructors that can optionally take the operation inputs and attributes as parameters. diff --git a/docs/template_extension/op.cpp b/docs/template_extension/op.cpp index e6a7f950aa18b5..bdd7ff81023af7 100644 --- a/docs/template_extension/op.cpp +++ b/docs/template_extension/op.cpp @@ -5,9 +5,9 @@ using namespace TemplateExtension; -constexpr ngraph::NodeTypeInfo Operation::type_info; - //! [op:ctor] +NGRAPH_RTTI_DEFINITION(TemplateExtension::Operation, "Template", 0); + Operation::Operation(const ngraph::Output &arg, int64_t add) : Op({arg}), add(add) { constructor_validate_and_infer_types(); } diff --git a/docs/template_extension/op.hpp b/docs/template_extension/op.hpp index ffdc11b014248b..aabad8a8c4f9fa 100644 --- a/docs/template_extension/op.hpp +++ b/docs/template_extension/op.hpp @@ -11,8 +11,7 @@ namespace TemplateExtension { class Operation : public ngraph::op::Op { public: - static constexpr ngraph::NodeTypeInfo type_info{"Template", 0}; - const ngraph::NodeTypeInfo& get_type_info() const override { return type_info; } + NGRAPH_RTTI_DECLARATION; Operation() = default; Operation(const ngraph::Output& arg, int64_t add); From b65151abac800c0533e11ecde74e99f990d95b41 Mon Sep 17 00:00:00 2001 From: Ilya Churaev Date: Fri, 5 Mar 2021 07:07:37 +0300 Subject: [PATCH 2/2] Fixed comments --- docs/IE_DG/Extensibility_DG/AddingNGraphOps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/IE_DG/Extensibility_DG/AddingNGraphOps.md b/docs/IE_DG/Extensibility_DG/AddingNGraphOps.md index ed0c0aad75d34d..23a0ab21514d5d 100644 --- a/docs/IE_DG/Extensibility_DG/AddingNGraphOps.md +++ b/docs/IE_DG/Extensibility_DG/AddingNGraphOps.md @@ -6,7 +6,7 @@ Inference Engine Extension API allows to register operation sets (opsets) with c To add your custom nGraph operation, create a new class that extends `ngraph::Op`, which is in turn derived from `ngraph::Node`, the base class for all graph operations in nGraph. Follow the steps below: -1. Add the `NGRAPH_RTTI_DECLARATION` and `NGRAPH_RTTI_DEFINITION` macros that define a `NodeTypeInfo` object that identifies the type of the operation to the graph users and helps with dynamic type resolution. The type info of an nGraph operation currently consists of a string identifier and a version number, but this may change in the future. +1. Add the `NGRAPH_RTTI_DECLARATION` and `NGRAPH_RTTI_DEFINITION` macros which define a `NodeTypeInfo` object that identifies the type of the operation to the graph users and helps with dynamic type resolution. The type info of an nGraph operation currently consists of a string identifier and a version number, but this may change in the future. 2. Implement constructors that can optionally take the operation inputs and attributes as parameters.