Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated nGraph custom op documentation #4604

Merged
merged 2 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/IE_DG/Extensibility_DG/AddingNGraphOps.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
ilyachur marked this conversation as resolved.
Show resolved Hide resolved

2. Implement constructors that can optionally take the operation inputs and attributes as parameters.

Expand Down
4 changes: 2 additions & 2 deletions docs/template_extension/op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ngraph::Node> &arg, int64_t add) : Op({arg}), add(add) {
constructor_validate_and_infer_types();
}
Expand Down
3 changes: 1 addition & 2 deletions docs/template_extension/op.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ngraph::Node>& arg, int64_t add);
Expand Down