Class PaddlePassBuilder

Inheritance Relationships

Derived Type

Class Documentation

class paddle::PaddlePassBuilder

This class build passes based on vector<string> input. It is part of inference API. Users can build passes, insert new passes, delete passes using this class and its functions.

Example Usage: Build a new pass.

const vector<string> passes(1, "conv_relu_mkldnn_fuse_pass");
PaddlePassBuilder builder(passes);

Subclassed by paddle::PassStrategy

Public Functions

inline explicit PaddlePassBuilder(const std::vector<std::string> &passes)

Constructor of the class. It stores the input passes.

Parameters

passes[in] passes’ types.

inline void SetPasses(std::initializer_list<std::string> passes)

Stores the input passes.

Parameters

passes[in] passes’ types.

void AppendPass(const std::string &pass_type)

Append a pass to the end of the passes.

Parameters

pass_type[in] the type of the new pass.

void InsertPass(size_t idx, const std::string &pass_type)

Insert a pass to a specific position.

Parameters
  • idx[in] the position to insert.

  • pass_type[in] the type of insert pass.

void DeletePass(size_t idx)

Delete the pass at certain position ‘idx’.

Parameters

idx[in] the position to delete.

void DeletePass(const std::string &pass_type)

Delete all passes that has a certain type ‘pass_type’.

Parameters

pass_type[in] the certain pass type to be deleted.

void ClearPasses()

Delete all the passes.

void AppendAnalysisPass(const std::string &pass)

Append an analysis pass.

Parameters

pass[in] the type of the new analysis pass.

void TurnOnDebug()

Visualize the computation graph after each pass by generating a DOT language file, one can draw them with the Graphviz toolkit.

std::string DebugString()

Human-readable information of the passes.

inline const std::vector<std::string> &AllPasses() const

Get information of passes.

Returns

Return list of the passes.

inline std::vector<std::string> AnalysisPasses() const

Get information of analysis passes.

Returns

Return list of analysis passes.