Initial nGraph Transformations type info (#1635)

This commit is contained in:
Gleb Kazantaev 2020-08-07 06:06:32 +03:00 committed by GitHub
parent 09c43536fe
commit 764eff9819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 32 additions and 0 deletions

View File

@ -32,6 +32,10 @@
using namespace ngraph;
using namespace std;
NGRAPH_RTTI_DEFINITION(ngraph::pass::GetOutputElementElimination,
"ngraph::pass::GetOutputElementElimination",
0);
bool pass::GetOutputElementElimination::run_on_node(shared_ptr<Node> n)
{
bool optimized = false;

View File

@ -30,6 +30,8 @@ NGRAPH_SUPPRESS_DEPRECATED_START
class NGRAPH_API ngraph::pass::GetOutputElementElimination : public NodePass
{
public:
NGRAPH_RTTI_DECLARATION;
bool run_on_node(std::shared_ptr<Node> node) override;
};
NGRAPH_SUPPRESS_DEPRECATED_END

View File

@ -62,6 +62,10 @@ using namespace ngraph;
// If MatcherPass register more than one node make sure that this nodes are registered in
// topological order.
NGRAPH_RTTI_DEFINITION(ngraph::pass::GraphRewrite, "ngraph::pass::GraphRewrite", 0);
NGRAPH_RTTI_DEFINITION(ngraph::pass::MatcherPass, "ngraph::pass::MatcherPass", 0);
bool pass::GraphRewrite::run_on_function(shared_ptr<Function> f)
{
OV_ITT_SCOPED_TASK(itt::domains::Ngraph, "pass::GraphRewrite::run_on_function");

View File

@ -57,6 +57,8 @@ namespace ngraph
class NGRAPH_API ngraph::pass::MatcherPass : public ngraph::pass::PassBase
{
public:
NGRAPH_RTTI_DECLARATION;
MatcherPass() = default;
MatcherPass(const MatcherPass&) = delete;
@ -114,6 +116,8 @@ private:
class NGRAPH_API ngraph::pass::GraphRewrite : public ngraph::pass::FunctionPass
{
public:
NGRAPH_RTTI_DECLARATION;
GraphRewrite() = default;
explicit GraphRewrite(const std::shared_ptr<MatcherPass>& pass)

View File

@ -27,6 +27,10 @@ using namespace ngraph;
NGRAPH_SUPPRESS_DEPRECATED_START
NGRAPH_RTTI_DEFINITION(ngraph::pass::FunctionPass, "ngraph::pass::FunctionPass", 0);
NGRAPH_RTTI_DEFINITION(ngraph::pass::NodePass, "ngraph::pass::NodePass", 0);
pass::PassBase::PassBase()
: m_property{all_pass_property_off}
{

View File

@ -57,6 +57,10 @@ namespace ngraph
void set_callback(const param_callback& callback);
using type_info_t = DiscreteTypeInfo;
virtual const type_info_t& get_type_info() const = 0;
protected:
ManagerState& get_state();
void set_state(ManagerState&);
@ -82,6 +86,7 @@ namespace ngraph
class NGRAPH_API FunctionPass : public PassBase
{
public:
NGRAPH_RTTI_DECLARATION;
virtual ~FunctionPass();
virtual bool run_on_function(std::shared_ptr<ngraph::Function>) = 0;
};
@ -90,6 +95,7 @@ namespace ngraph
: public PassBase
{
public:
NGRAPH_RTTI_DECLARATION;
virtual ~NodePass();
virtual bool run_on_node(std::shared_ptr<ngraph::Node>) = 0;
};

View File

@ -20,6 +20,8 @@
using namespace ngraph;
NGRAPH_RTTI_DEFINITION(ngraph::pass::Validate, "ngraph::pass::Validate", 0);
bool pass::Validate::run_on_function(std::shared_ptr<Function> f)
{
f->validate_nodes_and_infer_types();

View File

@ -37,6 +37,8 @@ namespace ngraph
class NGRAPH_API Validate : public FunctionPass
{
public:
NGRAPH_RTTI_DECLARATION;
Validate()
: FunctionPass()
{

View File

@ -183,6 +183,8 @@ static std::string label_edge(const std::shared_ptr<Node>& /* src */,
return ss.str();
}
NGRAPH_RTTI_DEFINITION(ngraph::pass::VisualizeTree, "ngraph::pass::VisualizeTree", 0);
bool pass::VisualizeTree::run_on_module(vector<shared_ptr<Function>>& functions)
{
for (shared_ptr<Function> f : functions)

View File

@ -41,6 +41,8 @@ class HeightMap;
class NGRAPH_API ngraph::pass::VisualizeTree : public ModulePass
{
public:
NGRAPH_RTTI_DECLARATION;
using node_modifiers_t =
std::function<void(const Node& node, std::vector<std::string>& attributes)>;
VisualizeTree(const std::string& file_name,