class ngraph::pass::Manager


#include <manager.hpp>

class Manager
    // construction

    Manager(std::shared_ptr<PassConfig> pass_config);

    // methods

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

    void run_passes(std::shared_ptr<Function>);
    void set_pass_visualization(bool new_state);
    void set_per_pass_validation(bool new_state);
    void set_callback(const param_callback& callback);
    std::shared_ptr<PassConfig> get_pass_config();

Detailed Documentation


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.

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

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

manager.register_pass<MyTransformation, false>();


shared_ptr to the transformation instance

void set_per_pass_validation(bool new_state)

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



Value “true” enables Validate pass run; “false”, otherwise

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; }.



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

std::shared_ptr<PassConfig> get_pass_config()


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.