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

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

Constructor of the class. It stores the input passes.

Parameters
  • [in] passes: passes’ types.

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

Stores the input passes.

Parameters
  • [in] passes: passes’ types.

void AppendPass(const std::string &pass_type)

Append a pass to the end of the passes.

Parameters
  • [in] pass_type: the type of the new pass.

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

Insert a pass to a specific position.

Parameters
  • [in] idx: the position to insert.

  • [in] pass_type: the type of insert pass.

void DeletePass(size_t idx)

Delete the pass at certain position ‘idx’.

Parameters
  • [in] idx: the position to delete.

void DeletePass(const std::string &pass_type)

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

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

void ClearPasses()

Delete all the passes.

void AppendAnalysisPass(const std::string &pass)

Append an analysis pass.

Parameters
  • [in] pass: 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.

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

Get information of passes.

Return

Return list of the passes.

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

Get information of analysis passes.

Return

Return list of analysis passes.