class ngraph::pass::MatcherPass¶
Overview¶
MatcherPass is a basic block for pattern based transformations. It describes pattern and action that is applied if pattern is matched. More…
#include <graph_rewrite.hpp>
class MatcherPass: public ngraph::pass::PassBase
{
public:
// construction
MatcherPass();
MatcherPass(const MatcherPass&);
MatcherPass(
const std::string& name,
const std::shared_ptr<pattern::Matcher>& m,
const handler_callback& handler,
const PassPropertyMask& property = PassProperty::CHANGE_DYNAMIC_STATE
);
// methods
MatcherPass& operator = (const MatcherPass&);
bool apply(std::shared_ptr<ngraph::Node> node);
template <typename T, class... Args>
std::shared_ptr<T> register_new_node(Args&&... args);
const std::vector<std::shared_ptr<ngraph::Node>>& get_new_nodes();
void clear_new_nodes();
std::shared_ptr<pattern::Matcher> get_matcher();
};
// direct descendants
class ConvertReduceBase;
class AddAddFusion;
class AddFakeQuantizeFusion;
class AddMultiplyFusion;
class BatchNormDecomposition;
class BatchToSpaceFusion;
class BidirectionalGRUSequenceDecomposition;
class BidirectionalLSTMSequenceDecomposition;
class BidirectionalRNNSequenceDecomposition;
class BinarizeWeights;
class BroadcastElementwiseFusion;
class ClampFusion;
class ConvAddFusion;
class ConvMultiplyFusion;
class ConvToBinaryConv;
class ConvertBatchToSpace;
class ConvertBroadcast3;
class ConvertBroadcastToTiles;
class ConvertConvolution;
class ConvertDeconvolution;
class ConvertDepthToSpace;
class ConvertDivide;
class ConvertGELU;
class ConvertGRUSequenceToTensorIterator;
class ConvertGather0D;
class ConvertGather1ToGather7;
class ConvertGather7ToGather1;
class ConvertGroupConvolution;
class ConvertGroupDeconvolution;
class ConvertInterpolate1ToInterpolate4;
class ConvertLSTMSequenceToTensorIterator;
class ConvertMVN1ToMVN6;
class ConvertMinimum;
class ConvertMod;
class ConvertNMS1ToNMS5;
class ConvertNMS3ToNMS5;
class ConvertNMS4ToNMS5;
class ConvertNMSToNMSIEInternal;
class ConvertNegative;
class ConvertPadToGroupConvolution;
class ConvertQuantizeDequantize;
class ConvertRNNSequenceToTensorIterator;
class ConvertScatterElementsToScatter;
class ConvertShapeOf3;
class ConvertShuffleChannels3;
class ConvertSpaceToBatch;
class ConvertSpaceToDepth;
class ConvertSubtract;
class ConvertTensorIteratorToGRUSequence;
class ConvertTensorIteratorToLSTMSequence;
class ConvertTensorIteratorToRNNSequence;
class ConvertTopK3;
class ConvolutionBackpropDataMultiplyFusion;
class ConvolutionMultiplyFusion;
class DeconvAddFusion;
class DepthToSpaceFusion;
class DilatedConvolutionConverter;
class DisableConvertConstantFoldingOnConstPath;
class EinsumDecomposition;
class EliminateUnsqueezeGather;
class FakeQuantizeDecomposition;
class FakeQuantizeMulFusion;
class FakeQuantizeReshapeFusion;
class GRUCellDecomposition;
class GatherNegativeConstIndicesNormalize;
class Gelu7Downgrade;
class GeluFusionWithErfOne;
class GeluFusionWithErfThree;
class GeluFusionWithErfTwo;
class GroupConvolutionBackpropDataMultiplyFusion;
class GroupConvolutionMultiplyFusion;
class HSigmoidDecomposition;
class HSigmoidFusionWithClamp;
class HSigmoidFusionWithReluDiv;
class HSigmoidFusionWithReluMul;
class HSigmoidFusionWithoutRelu;
class HSwishDecomposition;
class HSwishFusionWithClampDiv;
class HSwishFusionWithClampMul;
class HSwishFusionWithHSigmoidMul;
class HSwishFusionWithReluDiv;
class HSwishFusionWithReluMul;
class HSwishFusionWithoutRelu;
class LSTMCellDecomposition;
class LogSoftmaxDecomposition;
class MVN6Decomposition;
class MVNFusionWithConstantsInside;
class MVNFusionWithoutConstants;
class MishFusion;
class MulFakeQuantizeFusion;
class MultiplyMultiplyFusion;
class NormalizeL2FusionWithAdd;
class NormalizeL2FusionWithMax;
class PadFusionAvgPool;
class PadFusionConvolution;
class PadFusionConvolutionBackpropData;
class PadFusionGroupConvolution;
class PadFusionGroupConvolutionBackpropData;
class PadFusionMaxPool;
class Proposal1Scales;
class Proposal4Scales;
class PullTransposeThroughFQUp;
class RNNCellDecomposition;
class ReduceL1Decomposition;
class ReduceL2Decomposition;
class ReluFakeQuantizeFusion;
class RemoveFilteringBoxesBySize;
class ReshapeAMatMul;
class ReshapeBMatMul;
class ReshapeTo1D;
class ShuffleChannelsFusion;
class SoftPlusDecomposition;
class SoftPlusFusion;
class SoftPlusToMishFusion;
class SoftmaxFusion;
class SpaceToBatchFusion;
class SplitSqueezeConcatFusion;
class SqueezeStridedSlice;
class StridedSliceSqueeze;
class SwishFusionWithBeta;
class SwishFusionWithSigmoid;
class SwishFusionWithSigmoidWithBeta;
class SwishFusionWithoutBeta;
class TransposeFQReduction;
class TransposeFuse;
class TransposeMatMul;
class TransposeReduction;
class TransposeToReshape;
class WeightsDequantizeToFakeQuantize;
Inherited Members¶
public:
// typedefs
typedef DiscreteTypeInfo type_info_t;
// methods
bool get_property(const PassPropertyMask& prop_mask) const;
void set_name(const std::string& name);
std::string get_name() const;
void set_callback(const param_callback& callback);
virtual void set_pass_config(const std::shared_ptr<PassConfig>& pass_config);
std::shared_ptr<PassConfig> get_pass_config();
bool m_transformation_callback(const std::shared_ptr<const Node>& node);
bool transformation_callback(const std::shared_ptr<const Node>& node);
virtual const type_info_t& get_type_info() const = 0;
Detailed Documentation¶
MatcherPass is a basic block for pattern based transformations. It describes pattern and action that is applied if pattern is matched.
MatcherPass consists of Matcher and matcher_pass_callback that needs to be implemented and finally registered by using
See also:
register_matcher. MatcherPass can be executed on node within
apply method. To run matcher pass on Function use GraphRewrite. In addition MatcherPass provides a way for adding new operations into GraphRewrite execution queue. That means that operations that were created inside transformation callback can be added for matching. To register node use
register_new_node method. GraphRewrite automatically takes registered nodes and put them to execution queue. If multiple nodes were register make sure that they were registered in topological order. Note: when implementing pattern for Matcher make sure that root node is an operation from opset or has ngraph::pattern::op::WrapType. That will help GraphRewrite to execute matcher passes more efficient.