Single Op Transform Base class. More...
#include <single_op_transform.h>
Protected Member Functions | |
bool | PatternRule (const transform::Graph &g, const std::vector< int > &subgraph, int idx) override |
The PatternRule essentially answers: Given the current subgraph (ordered), should we append the new node at idx? | |
bool | ValidatorRule (const transform::Graph &g, const std::vector< int > &subgraph) override |
The ValidatorRule essentially answers: Given a subgraph, can we accept it? | |
bool | ReplaceRule (const std::vector< int > &subgraph, transform::Graph *g_ptr) override |
The ReplaceRule actually mutates the graph, and applies the transformation upon the subgraph. | |
virtual bool | MatchOperator (const OperatorDef &op)=0 |
virtual void | ReplaceOperator (OperatorDef *op)=0 |
Protected Member Functions inherited from caffe2::Transform | |
void | SetPatternMatchType (PatternMatchType type) |
Additional Inherited Members | |
Public Types inherited from caffe2::Transform | |
enum | PatternMatchType { CONNECTED_SUBGRAPH, SORTED_WRT_EXECUTION_ORDER, GENERAL } |
Determines the type of subgraphs that PatternMatch will find. More... | |
Public Member Functions inherited from caffe2::Transform | |
NetDef | ApplyTo (const NetDef &orig_net_def) |
Apply a Transform onto a NetDef. More... | |
std::vector< std::vector< int > > | PatternMatch (const transform::Graph &graph) |
Generates all matches (stored as ordered subgraphs) and returns them. More... | |
void | ReplacePattern (const std::vector< std::vector< int >> &matches, transform::Graph *graph) |
Applies the replace rule onto each of the matches found. | |
Single Op Transform Base class.
A transform which is applied to a single node, in place.
Transforms which derive from SingleOpTransform need to override: ReplaceOperator and MatchOperator.
Definition at line 18 of file single_op_transform.h.