skip.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  /// The graph value is added to the matched value list. If the predicate is true, the
29  /// match succeeds if the arguments match; if the predicate is false, the match succeeds
30  /// if the pattern input matches the graph value.
31  class NGRAPH_API Skip : public Pattern
32  {
33  public:
34  static constexpr NodeTypeInfo type_info{"patternSkip", 0};
35  const NodeTypeInfo& get_type_info() const override;
36  Skip(const Output<Node>& arg, ValuePredicate pred)
37  : Pattern({arg}, pred)
38  {
39  set_output_type(0, arg.get_element_type(), arg.get_partial_shape());
40  }
41 
42  Skip(const Output<Node>& arg, NodePredicate pred = nullptr)
43  : Pattern({arg}, as_value_predicate(pred))
44  {
45  set_output_type(0, arg.get_element_type(), arg.get_partial_shape());
46  }
47 
48  virtual bool match_value(pattern::Matcher* matcher,
49  const Output<Node>& pattern_value,
50  const Output<Node>& graph_value) override;
51  };
52  }
53  }
54 }
ngraph::pattern::op::Skip
Definition: skip.hpp:32
ngraph::pattern::op::Skip::get_type_info
const NodeTypeInfo & get_type_info() const override
ngraph::pattern::op::Pattern
Definition: pattern.hpp:79
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28