or.hpp
1 //*****************************************************************************
2 // Copyright 2017-2020 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //*****************************************************************************
16 
17 #pragma once
18 
19 #include "ngraph/node.hpp"
20 #include "ngraph/pattern/op/pattern.hpp"
21 
22 namespace ngraph
23 {
24  namespace pattern
25  {
26  namespace op
27  {
28  /// A submatch on the graph value is performed on each input to the Or; the match
29  /// succeeds on the first match. Otherwise the match fails.
30  class NGRAPH_API Or : public Pattern
31  {
32  public:
33  static constexpr NodeTypeInfo type_info{"patternOr", 0};
34  const NodeTypeInfo& get_type_info() const override;
35  /// \brief creates an Or node matching one of several sub-patterns in order. Does
36  /// not add node to match list.
37  /// \param patterns The patterns to try for matching
38  Or(const OutputVector& patterns)
39  : Pattern(patterns)
40  {
41  }
42 
43  bool match_value(pattern::Matcher* matcher,
44  const Output<Node>& pattern_value,
45  const Output<Node>& graph_value) override;
46  };
47  }
48  }
49 }
ngraph::pattern::op::Or::Or
Or(const OutputVector &patterns)
creates an Or node matching one of several sub-patterns in order. Does not add node to match list.
Definition: or.hpp:38
ngraph::pattern::op::Or
Definition: or.hpp:31
ngraph::pattern::Matcher
Definition: matcher.hpp:75
ngraph::pattern::op::Pattern
Definition: pattern.hpp:79
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
ngraph::pattern::op::Or::get_type_info
const NodeTypeInfo & get_type_info() const override