Class ov::pass::pattern::op::Optional#

class Optional : public ov::pass::pattern::op::Pattern#

A submatch on the graph value which contains optional op types defined in constructor. Optional pattern supports multi input operations. In this case the pattern checks inputs with optional node type or 1st input. The match is succeed in case of full graphs matching or extended by one of optional type graph or pattern. Otherwise fails.

Public Functions

inline Optional(const std::vector<DiscreteTypeInfo> &type_infos, const OutputVector &inputs = {}, const pattern::op::ValuePredicate &pred = [](const Output< Node > &output) { return true;})#

creates an optional node matching one pattern. Add nodes to match list.

Parameters:
  • type_infosOptional operation types to exclude them from the matching in case the following op types do not exist in a pattern to match.

  • patterns – The pattern to match a graph.