variable.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <ngraph/node.hpp>
8 #include <utility>
9 
10 namespace ngraph
11 {
12  struct VariableInfo
13  {
14  PartialShape data_shape;
15  element::Type data_type;
16  std::string variable_id;
17  };
18 
19  class NGRAPH_API Variable
20  {
21  public:
22  Variable() = default;
23 
24  explicit Variable(const VariableInfo& variable_info)
25  : m_info(variable_info)
26  {
27  }
28 
29  VariableInfo get_info() const { return m_info; }
30  void update(const VariableInfo& variable_info) { m_info = variable_info; }
31 
32  private:
33  VariableInfo m_info;
34  };
35  using VariablePtr = std::shared_ptr<Variable>;
36  using VariableVector = std::vector<VariablePtr>;
37 
38  template <>
39  class NGRAPH_API AttributeAdapter<std::shared_ptr<Variable>>
40  : public DirectValueAccessor<std::shared_ptr<Variable>>
41  {
42  public:
43  explicit AttributeAdapter(std::shared_ptr<Variable>& value)
45  {
46  }
47 
48  static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<std::shared_ptr<Variable>>",
49  0};
50  const DiscreteTypeInfo& get_type_info() const override { return type_info; }
51  };
52 } // namespace ngraph
An AttributeAdapter "captures" an attribute as an AT& and makes it available as a ValueAccessor<VAT>.
Definition: attribute_adapter.hpp:161
Definition: attribute_adapter.hpp:67
Class representing a shape that may be partially or totally dynamic.
Definition: partial_shape.hpp:34
Definition: variable.hpp:20
Definition: element_type.hpp:51
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: type.hpp:27
Definition: variable.hpp:13