null_node.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 <memory>
20 
21 #include "ngraph/node.hpp"
22 #include "onnx_import/utils/onnx_importer_visibility.hpp"
23 
24 namespace ngraph
25 {
26  namespace op
27  {
28  ONNX_IMPORTER_API
29  bool is_null(const ngraph::Node* node);
30  ONNX_IMPORTER_API
31  bool is_null(const std::shared_ptr<ngraph::Node>& node);
32  ONNX_IMPORTER_API
33  bool is_null(const Output<ngraph::Node>& output);
34  }
35  namespace onnx_import
36  {
37  /// \brief Represents a missing optional input or output of an ONNX node
38  ///
39  /// Some ONNX operators have inputs or outputs that are marked as optional,
40  /// which means that a referring node MAY forgo providing values for such inputs
41  /// or computing these outputs.
42  /// An empty string is used in place of a name of such input or output.
43  ///
44  /// More:
45  /// https://github.com/onnx/onnx/blob/master/docs/IR.md#optional-inputs-and-outputs
46  class NullNode : public ngraph::Node
47  {
48  public:
49  static constexpr NodeTypeInfo type_info{"NullNode", 0};
50  const NodeTypeInfo& get_type_info() const override { return type_info; }
51  NullNode() = default;
52 
53  virtual std::shared_ptr<Node>
54  clone_with_new_inputs(const OutputVector& new_args) const override;
55  };
56  } // namespace onnx_import
57 } // namespace ngraph
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
ngraph::Node
Definition: node.hpp:131
ngraph::onnx_import::NullNode
Represents a missing optional input or output of an ONNX node.
Definition: null_node.hpp:47
ngraph::onnx_import::NullNode::get_type_info
const NodeTypeInfo & get_type_info() const override
Definition: null_node.hpp:50