@@ -43,6 +43,25 @@ class ngraph::pass::Manager
43
43
44
44
template <typename T, class ... Args>
45
45
void register_pass (Args&&... args)
46
+ {
47
+ push_pass<T>(std::forward<Args>(args)...);
48
+ if (m_per_pass_validation)
49
+ {
50
+ push_pass<Validate>();
51
+ }
52
+ }
53
+
54
+ void run_passes (std::shared_ptr<Function>, bool transitive = true );
55
+
56
+ ManagerState& get_state ();
57
+ PassConfig& get_pass_config () { return m_pass_config; }
58
+ void set_pass_config (const PassConfig& pass_config) { m_pass_config = pass_config; }
59
+ void set_pass_visualization (bool new_state) { m_visualize = new_state; }
60
+ void set_pass_serialization (bool new_state) { m_serialize = new_state; }
61
+ void set_per_pass_validation (bool new_state) { m_per_pass_validation = new_state; }
62
+ private:
63
+ template <typename T, class ... Args>
64
+ void push_pass (Args&&... args)
46
65
{
47
66
static_assert (std::is_base_of<pass::PassBase, T>::value, " pass not derived from pass base" );
48
67
auto pass = std::make_shared<T>(std::forward<Args>(args)...);
@@ -61,23 +80,8 @@ class ngraph::pass::Manager
61
80
m_pass_names.push_back (typeid (T).name ());
62
81
#endif
63
82
}
64
- if (m_per_pass_validation)
65
- {
66
- auto validate = std::make_shared<Validate>();
67
- auto validate_base = std::static_pointer_cast<PassBase>(validate);
68
- m_pass_list.push_back (validate_base);
69
- }
70
83
}
71
84
72
- void run_passes (std::shared_ptr<Function>, bool transitive = true );
73
-
74
- ManagerState& get_state ();
75
- PassConfig& get_pass_config () { return m_pass_config; }
76
- void set_pass_config (const PassConfig& pass_config) { m_pass_config = pass_config; }
77
- void set_pass_visualization (bool new_state) { m_visualize = new_state; }
78
- void set_pass_serialization (bool new_state) { m_serialize = new_state; }
79
- void set_per_pass_validation (bool new_state) { m_per_pass_validation = new_state; }
80
- private:
81
85
std::vector<std::string> m_pass_names;
82
86
std::vector<std::shared_ptr<PassBase>> m_pass_list;
83
87
ManagerState m_state;
0 commit comments