Public Member Functions | Protected Member Functions | Protected Attributes
ngraph::pass::Manager Class Reference

Public Member Functions

 Manager (std::shared_ptr< PassConfig > pass_config)
 
template<typename T , bool Enable = true, class... Args>
std::shared_ptr< T > register_pass (Args &&... args)
 Register given transformation class type to execution list Example below show the basic usage of pass::Manager. More...
 
void run_passes (std::shared_ptr< Function >)
 
void set_pass_visualization (bool new_state)
 
void set_per_pass_validation (bool new_state)
 Set flag to enable/disable running Validate pass after executing each registered pass. More...
 
void set_callback (const param_callback &callback)
 Callback is a lambda function that can be used by registered transformations. The main purpose of this callback is to provide a way for plugins to disable/enable transformations based on some conditions. In some cases plugins may want not to execute some transformations. For example plugin can disable unpleasant decompositions because of performance reasons for some cases. Callback example: auto callback = [](const std::shared_ptr<const ngraph::Node> & node) -> bool { return std::dynamic_pointer_cast<const ngraph::opset3::DepthToSpace>(node) != nullptr; }; This callback returns true in case of DepthToSpace operation. So when execution DepthToSpace decomposition pass will check is this decomposition needed or plugin can execute this operation directly. And of course on transformation side we need to have a response for this callback. if (transformation_callback(batch_to_space)) { return false; }. More...
 
std::shared_ptr< PassConfigget_pass_config ()
 

Protected Member Functions

template<typename T , class... Args>
std::shared_ptr< T > push_pass (Args &&... args)
 

Protected Attributes

std::shared_ptr< PassConfigm_pass_config
 
std::vector< std::shared_ptr< PassBase > > m_pass_list
 
bool m_visualize = false
 
bool m_per_pass_validation = true
 

Member Function Documentation

◆ get_pass_config()

std::shared_ptr<PassConfig> ngraph::pass::Manager::get_pass_config ( )
inline
Returns
PassConfig shared object. This object is used for transformations pipeline configuration. This object allows to disable/enable transformations execution, set callback to particular transformation. For mo details see PassConfig class.

◆ register_pass()

template<typename T , bool Enable = true, class... Args>
std::shared_ptr<T> ngraph::pass::Manager::register_pass ( Args &&...  args)
inline

Register given transformation class type to execution list Example below show the basic usage of pass::Manager.

pass::Manager manager;
manager.register_pass<MyTransformation>(/*transformation constructor ars*&zwj;/);
manager.run_passes(f);

For some purposes transformation can be registered and disabled by default.

manager.register_pass<MyTransformation, false>();
Returns
shared_ptr to the transformation instance

◆ set_callback()

void ngraph::pass::Manager::set_callback ( const param_callback &  callback)
inline

Callback is a lambda function that can be used by registered transformations. The main purpose of this callback is to provide a way for plugins to disable/enable transformations based on some conditions. In some cases plugins may want not to execute some transformations. For example plugin can disable unpleasant decompositions because of performance reasons for some cases. Callback example: auto callback = [](const std::shared_ptr<const ngraph::Node> & node) -> bool { return std::dynamic_pointer_cast<const ngraph::opset3::DepthToSpace>(node) != nullptr; }; This callback returns true in case of DepthToSpace operation. So when execution DepthToSpace decomposition pass will check is this decomposition needed or plugin can execute this operation directly. And of course on transformation side we need to have a response for this callback. if (transformation_callback(batch_to_space)) { return false; }.

Parameters
callbacklamda function that returns true in case if node is supported by plugin and transformation is not needed

◆ set_per_pass_validation()

void ngraph::pass::Manager::set_per_pass_validation ( bool  new_state)
inline

Set flag to enable/disable running Validate pass after executing each registered pass.

Parameters
new_stateValue "true" enables Validate pass run; "false", otherwise

The documentation for this class was generated from the following file: