Class ov::pass::MatcherPass#

class MatcherPass : public ov::pass::PassBase#

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

See also

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

See also

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 ov::pass::pattern::op::WrapType. That will help GraphRewrite to execute matcher passes more efficient.

Subclassed by ConvertReduceBase, CvtReduceBase, ov::pass::AUGRUCellFusion, ov::pass::AbsSinking, ov::pass::AdaptivePoolToReduce, ov::pass::AddAddFusion, ov::pass::AddFakeQuantizeFusion, ov::pass::AddMultiplyFusion, ov::pass::AlignEltwiseInputRanks, ov::pass::BatchNormDecomposition, ov::pass::BatchToSpaceFusion, ov::pass::BidirectionalGRUSequenceDecomposition, ov::pass::BidirectionalLSTMSequenceDecomposition, ov::pass::BidirectionalRNNSequenceDecomposition, ov::pass::BinarizeWeights, ov::pass::BroadcastConstRangeReplacement, ov::pass::BroadcastElementwiseFusion, ov::pass::BroadcastTransition, ov::pass::ChainedMaximumOptimization, ov::pass::ClampFusion, ov::pass::CompressFloatConstantsImpl, ov::pass::CompressWeightsWithFakeConvert, ov::pass::CompressWeightsWithFakeQuantize, ov::pass::ConcatFusion, ov::pass::ConcatToBroadcast, ov::pass::ConvStridesPropagation, ov::pass::ConvToBinaryConv, ov::pass::ConvertAvgPool14ToAvgPool1, ov::pass::ConvertBatchToSpace, ov::pass::ConvertBitwiseAndToLogicalAnd, ov::pass::ConvertBitwiseNotToLogicalNot, ov::pass::ConvertBitwiseOrToLogicalOr, ov::pass::ConvertBitwiseXorToLogicalXor, ov::pass::ConvertBroadcast3, ov::pass::ConvertBroadcastToTiles, ov::pass::ConvertConvertLike, ov::pass::ConvertConvertPromoteTypes, ov::pass::ConvertDeformableConv8To1, ov::pass::ConvertDepthToSpace, ov::pass::ConvertDetectionOutput1ToDetectionOutput8, ov::pass::ConvertDetectionOutput8ToDetectionOutput1, ov::pass::ConvertDivide, ov::pass::ConvertDivideWithConstant, ov::pass::ConvertEmbeddingBagOffsets15ToEmbeddingBagOffsetsSum3, ov::pass::ConvertEmbeddingBagPacked15ToEmbeddingBagPackedSum3, ov::pass::ConvertGELU, ov::pass::ConvertGP9ToGPIEInternal, ov::pass::ConvertGRUSequenceToTensorIterator, ov::pass::ConvertGather0D, ov::pass::ConvertGather1ToGather7, ov::pass::ConvertGather7ToGather1, ov::pass::ConvertGather7ToGather8, ov::pass::ConvertGather8ToGather7, ov::pass::ConvertGatherToGatherCompressed, ov::pass::ConvertInterpolate11ToInterpolate4, ov::pass::ConvertInterpolate1ToInterpolate4, ov::pass::ConvertLSTMSequenceToTensorIterator, ov::pass::ConvertLoopWithScatterUpdateToLSTMSequence, ov::pass::ConvertLoopWithSlicedInputConcatOutputToLSTMSequence, ov::pass::ConvertMVN1ToMVN6, ov::pass::ConvertMatrixNmsToMatrixNmsIE, ov::pass::ConvertMaxPool14ToMaxPool8, ov::pass::ConvertMaxPool1ToMaxPool8, ov::pass::ConvertMaxPool8ToMaxPool1, ov::pass::ConvertMinimum, ov::pass::ConvertMod, ov::pass::ConvertMulticlassNms8ToMulticlassNms9, ov::pass::ConvertMulticlassNmsToMulticlassNmsIE, ov::pass::ConvertNMS1ToNMS5, ov::pass::ConvertNMS1ToNMS9, ov::pass::ConvertNMS3ToNMS5, ov::pass::ConvertNMS3ToNMS9, ov::pass::ConvertNMS4ToNMS5, ov::pass::ConvertNMS4ToNMS9, ov::pass::ConvertNMS5ToNMS9, ov::pass::ConvertNMS9ToNMSIEInternal, ov::pass::ConvertNMSRotatedToNMSIEInternal, ov::pass::ConvertNMSToNMSIEInternal, ov::pass::ConvertNegative, ov::pass::ConvertPad12ToPad1, ov::pass::ConvertPadToGroupConvolution, ov::pass::ConvertPriorBox8To0, ov::pass::ConvertQuantizeDequantize, ov::pass::ConvertRNNSequenceToTensorIterator, ov::pass::ConvertROIAlign3To9, ov::pass::ConvertROIAlign9To3, ov::pass::ConvertScatterElementsToScatter, ov::pass::ConvertScatterElementsUpdate12ToScatterElementsUpdate3, ov::pass::ConvertScatterNDUpdate15ToScatterNDUpdate3, ov::pass::ConvertShapeOf3, ov::pass::ConvertShuffleChannels3, ov::pass::ConvertSliceScatter, ov::pass::ConvertSoftMax1ToSoftMax8, ov::pass::ConvertSoftMax8ToSoftMax1, ov::pass::ConvertSpaceToBatch, ov::pass::ConvertSpaceToDepth, ov::pass::ConvertSqueeze15ToSqueeze0, ov::pass::ConvertSubtract, ov::pass::ConvertSubtractWithConstant, ov::pass::ConvertTensorIteratorToGRUSequence, ov::pass::ConvertTensorIteratorToLSTMSequence, ov::pass::ConvertTensorIteratorToRNNSequence, ov::pass::ConvertTopK11ToTopK3, ov::pass::ConvertTopK3, ov::pass::ConvertU4WeightsZeroPointToScalar, ov::pass::ConvertXorToLogicalXor, ov::pass::ConvolutionBackpropDataMultiplyFusion, ov::pass::ConvolutionMultiplyFusion, ov::pass::ConvolutionToGroupConvolutionFusion, ov::pass::DeReshapeFullyConnected, ov::pass::DeReshapeMatMul, ov::pass::DepthToSpaceFusion, ov::pass::DilatedConvolutionConverter, ov::pass::DisableDecompressionConvertConstantFolding, ov::pass::DisableRandomUniformConstantFolding, ov::pass::DisableShapeOfConstantFolding, ov::pass::DivideFusion, ov::pass::DropoutWithRandomUniformReplacer, ov::pass::EinsumDecomposition, ov::pass::EliminateConcat, ov::pass::EliminateConvert, ov::pass::EliminateConvertNonZero, ov::pass::EliminateDuplicateTIInputs, ov::pass::EliminateEltwise, ov::pass::EliminateGatherUnsqueeze, ov::pass::EliminateLoopInputsOutputs, ov::pass::EliminateNopBroadcast, ov::pass::EliminatePad, ov::pass::EliminateReduceReshape, ov::pass::EliminateScatterUpdate, ov::pass::EliminateSlice, ov::pass::EliminateSliceBeforeGatherElements, ov::pass::EliminateSplit, ov::pass::EliminateSplitConcat, ov::pass::EliminateSqueeze, ov::pass::EliminateStridedSlice, ov::pass::EliminateStridedSliceByShape, ov::pass::EliminateTranspose, ov::pass::EliminateUnsqueeze, ov::pass::EliminateUnsqueezeGather, ov::pass::EnableDecompressionConvertConstantFolding, ov::pass::EnableShapeOfConstantFolding, ov::pass::EyeDecomposition, ov::pass::FakeQuantizeDecomposition, ov::pass::FakeQuantizeMulFusion, ov::pass::FakeQuantizeReshapeFusion, ov::pass::FlushFP32SubnormalsToZero, ov::pass::FoldSubgraphEmptyInputs, ov::pass::FuseLSTMSequencesToBidirectionalLSTMSequence, ov::pass::FuseReverseLSTMSequence, ov::pass::GRUCellDecomposition, ov::pass::GRUCellFusion, ov::pass::GatherNopElimination, ov::pass::Gelu7Downgrade, ov::pass::GeluFusionWithErfFour, ov::pass::GeluFusionWithErfOne, ov::pass::GeluFusionWithErfThree, ov::pass::GeluFusionWithErfTwo, ov::pass::GeluFusionWithTanh, ov::pass::GeluFusionWithTanhNoPower, ov::pass::GroupConvolutionBackpropDataMultiplyFusion, ov::pass::GroupConvolutionMultiplyFusion, ov::pass::GroupNormalizationDecomposition, ov::pass::GroupedGatherElimination, ov::pass::HSigmoidDecomposition, ov::pass::HSigmoidFusionWithClampDiv, ov::pass::HSigmoidFusionWithClampMul, ov::pass::HSigmoidFusionWithReluDiv, ov::pass::HSigmoidFusionWithReluMul, ov::pass::HSigmoidFusionWithoutRelu, ov::pass::HSwishDecomposition, ov::pass::HSwishFusionWithClamp, ov::pass::HSwishFusionWithHSigmoid, ov::pass::HSwishFusionWithReluDiv, ov::pass::HSwishFusionWithReluMul, ov::pass::HardSigmoidDecomposition, ov::pass::InitConstMask, ov::pass::InterpolateSequenceFusion, ov::pass::KeepConstAndDecompression, ov::pass::KeepConstantsPrecisionAndAddConverts, ov::pass::LSTMCellDecomposition, ov::pass::LSTMCellFusionWithJointWeights, ov::pass::LSTMCellFusionWithSplitWeights, ov::pass::LabelResolvingThroughSelect, ov::pass::LeakyReluFusion, ov::pass::LogSoftmaxDecomposition, ov::pass::LoraSubgraphFusion, ov::pass::MVN6Decomposition, ov::pass::MVNFusionWithConstantsInside, ov::pass::MVNFusionWithoutConstants, ov::pass::MarkCompressedFloatConstants, ov::pass::MarkDequantizationSubgraph, ov::pass::MarkFloatingPointRange, ov::pass::MarkRopeInputsToKeepInMixedPrecision, ov::pass::MatMulConstTransposesExtraction, ov::pass::MatMulMultiplyFusion, ov::pass::MishFusion, ov::pass::MoveEltwiseUpThroughDataMovPerChannel, ov::pass::MoveEltwiseUpThroughDataMovScalar, ov::pass::MulFakeQuantizeFusion, ov::pass::MultiplyConvolutionBackpropDataFusion, ov::pass::MultiplyConvolutionFusion, ov::pass::MultiplyGroupConvolutionBackpropDataFusion, ov::pass::MultiplyGroupConvolutionFusion, ov::pass::MultiplyMultiplyFusion, ov::pass::NearestNeighborUpsamplingFusion, ov::pass::NonZeroHorizontalFusion, ov::pass::NopBroadcast, ov::pass::NormalizeL2Decomposition, ov::pass::NormalizeL2Fusion, ov::pass::PReluFusionAbsSubMulMulAdd, ov::pass::PReluFusionMultiplyAdd, ov::pass::PReluFusionMultiplySub, ov::pass::PReluFusionNegReluMulAdd, ov::pass::PReluFusionNegativeAdd, ov::pass::PReluFusionNegativeSub, ov::pass::PadFusionAvgPool, ov::pass::PadFusionConvolution, ov::pass::PadFusionConvolutionBackpropData, ov::pass::PadFusionGroupConvolution, ov::pass::PadFusionGroupConvolutionBackpropData, ov::pass::PositionIDsReplacer, ov::pass::PrepareShapeOpsForEliminationAroundBE, ov::pass::PrevSequenceLengthPattern, ov::pass::Proposal1Scales, ov::pass::Proposal4Scales, ov::pass::PullReshapeThroughReduce, ov::pass::PullSqueezeThroughEltwise, ov::pass::PullTransposeThroughFQUp, ov::pass::PullUnsqueezeThroughReduce, ov::pass::RMSFusion, ov::pass::RNNCellDecomposition, ov::pass::RandomUniformFusion, ov::pass::ReduceL1Decomposition, ov::pass::ReduceL2Decomposition, ov::pass::ReduceMerge, ov::pass::ReduceReshapeFusion, ov::pass::ReluFakeQuantizeFusion, ov::pass::RemoveConcatZeroDimInput, ov::pass::RemoveFilteringBoxesBySize, ov::pass::ReplaceConcatReduceByMinOrMax, ov::pass::ReshapeAMatMul, ov::pass::ReshapeBMatMul, ov::pass::ReshapeOptimizations, ov::pass::ReshapePRelu, ov::pass::ReshapeSequenceFusion, ov::pass::ReshapeSinkingMatMul, ov::pass::ReshapeTo1D, ov::pass::RoPEFusionChatGLM, ov::pass::RoPEFusionCosSinPreprocess, ov::pass::RoPEFusionGPTJ, ov::pass::RoPEFusionGPTNEOX, ov::pass::RoPEFusionIOSlicing, ov::pass::RoPEFusionPreprocess, ov::pass::RoPEFusionQwen, ov::pass::RoPEShareCosSin, ov::pass::ScaledDotProductAttentionDecomposition, ov::pass::SelectWithOneValueCondition, ov::pass::SequenceFusion, ov::pass::ShapeOfConstFolding, ov::pass::ShuffleChannelsFusion, ov::pass::SimplifyCTCGreedyDecoderSeqLen, ov::pass::SimplifyGatherShapeOf, ov::pass::SimplifySecondInputOfReshape, ov::pass::SkipGatherBeforeTransposeAndReshape, ov::pass::SliceSequenceToSingleSlice, ov::pass::SliceToStridedSlice, ov::pass::SoftPlusDecomposition, ov::pass::SoftPlusFusion, ov::pass::SoftPlusToMishFusion, ov::pass::SoftSignDecomposition, ov::pass::SoftmaxDecomposition, ov::pass::SoftmaxFusion, ov::pass::SpaceToBatchFusion, ov::pass::SplitConcatPairToInterpolateFusion, ov::pass::SplitSqueezeConcatFusion, ov::pass::SqueezeStridedSlice, ov::pass::StateManagementPattern, ov::pass::StridedSliceSqueeze, ov::pass::SubtractFusion, ov::pass::SupportedNodesStridesPropagation, ov::pass::SwishFusionWithBeta, ov::pass::SwishFusionWithSigmoid, ov::pass::SwishFusionWithSigmoidWithBeta, ov::pass::SwishFusionWithoutBeta, ov::pass::TotalSequenceLengthPattern, ov::pass::TransposeConvert, ov::pass::TransposeEltwise, ov::pass::TransposeFQReduction, ov::pass::TransposeFuse, ov::pass::TransposeMatMul, ov::pass::TransposeReduction, ov::pass::TransposeReshapeEliminationForMatmul, ov::pass::TransposeToReshape, ov::pass::UniqueDecomposition, ov::pass::UnsupportedNodesStridesPropagation, ov::pass::WeightsDequantizeToFakeQuantize, ov::pass::WrapInterpolateIntoTransposes, ov::pass::low_precision::ConvertSubtractConstant, ov::pass::low_precision::CreatePrecisionsDependentAttribute< AttributeType, OperationType >, ov::pass::low_precision::LayerTransformation, ov::pass::low_precision::MarkupBias, ov::pass::low_precision::PropagateThroughPrecisionPreserved< AttributeType >, ov::pass::low_precision::PropagateToInput< AttributeType >, ov::pass::low_precision::PullReshapeThroughDequantization, ov::pass::low_precision::PullTransposeThroughDequantization, ov::pass::low_precision::UpdateSharedPrecisionPreserved< AttributeType, ExpectedAttributeType >, ov::pass::transpose_sinking::TSBinaryBackward, ov::pass::transpose_sinking::TSConcatBackward, ov::pass::transpose_sinking::TSCumSumBackward, ov::pass::transpose_sinking::TSDataMovementBackward, ov::pass::transpose_sinking::TSForwardBase, ov::pass::transpose_sinking::TSFuse, ov::pass::transpose_sinking::TSGatherBackward, ov::pass::transpose_sinking::TSInterpolateBackward, ov::pass::transpose_sinking::TSReductionBackward, ov::pass::transpose_sinking::TSResetNoSinkingAttribute, ov::pass::transpose_sinking::TSSliceBackward, ov::pass::transpose_sinking::TSSplitBackward, ov::pass::transpose_sinking::TSSqueezeBackward, ov::pass::transpose_sinking::TSTileBackward, ov::pass::transpose_sinking::TSUnaryBackward, ov::pass::transpose_sinking::TSUnsqueezeBackward