validate.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/pass/pass.hpp"
20 
21 namespace ngraph
22 {
23  namespace pass
24  {
25  /// \brief The Validate pass performs sanity checks on attributes and inputs, and
26  /// computes output shapes and element types for all computation nodes in a given
27  /// computation graph.
28  ///
29  /// \details The verification and inference is done via invoking each node's specific
30  /// implementation of \link ngraph::Node::validate_and_infer_types() \endlink function.
31  ///
32  /// By default, the \ref ngraph::pass::Manager runs this pass after executing every
33  /// optimization pass. This is to ensure that any update to the graph by an optimization
34  /// pass does not break the shape and data type requirement on a computation node.
35  /// This default validation run can be changed via calling the
36  /// \link ngraph::pass::Manager::set_per_pass_validation(bool) \endlink function.
37  class NGRAPH_API Validate : public FunctionPass
38  {
39  public:
40  NGRAPH_RTTI_DECLARATION;
41 
42  Validate()
43  : FunctionPass()
44  {
45  }
46  bool run_on_function(std::shared_ptr<ngraph::Function> f) override;
47  };
48  }
49 }
ngraph::pass::Validate
The Validate pass performs sanity checks on attributes and inputs, and computes output shapes and ele...
Definition: validate.hpp:38
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
ngraph::pass::FunctionPass
Definition: pass.hpp:76