forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ie_data.h
192 lines (164 loc) · 4.92 KB
/
ie_data.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief This header file defines the main Data representation node.
*
* @file ie_data.h
*/
#pragma once
#if !defined(IN_OV_COMPONENT) && !defined(IE_LEGACY_HEADER_INCLUDED)
# define IE_LEGACY_HEADER_INCLUDED
# ifdef _MSC_VER
# pragma message( \
"The Inference Engine API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
# else
# warning("The Inference Engine API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
# endif
#endif
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "ie_api.h"
#include "ie_common.h"
#include "ie_layouts.h"
#include "ie_precision.hpp"
namespace InferenceEngine {
IE_SUPPRESS_DEPRECATED_START
/**
* @deprecated The Inference Engine API is deprecated and will be removed in the 2024.0 release. For instructions on
* transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html
* @brief This class represents the main Data representation node.
*
* The NN graphs are di-graphs consisting of data nodes and layer nodes.
*/
class INFERENCE_ENGINE_1_0_DEPRECATED INFERENCE_ENGINE_API_CLASS(Data) {
class Impl;
public:
/**
* @brief An empty constructor (dimensionless)
*
* @param name Name of the data node
* @param _precision Precision of the data
* @param layout Data layout
*/
Data(const std::string& name, Precision _precision, Layout layout = NCHW);
/**
* @brief A constructor with tensor descriptor
*
* @param name Name of the data node
* @param desc Tensor descriptor
*/
Data(const std::string& name, const TensorDesc& desc);
/**
* @brief A copy constructor
*
* @param data A data object to copy from
*/
Data(const Data& data);
/**
* @brief An assignment operator
*
* @param data A data object to copy from
* @return An assigned object
*/
Data& operator=(const Data& data);
/**
* @brief Checks if the current node is resolved
*
* @return true if resolved, false otherwise.
*/
bool isInitialized() const;
/**
* @brief Sets the data dimensions.
*
* After the current node is marked as resolved.
*
* @param a_dims Tensor dimensions to set
*/
void setDims(const SizeVector& a_dims);
/**
* @brief Sets the layout value for this Data instance
*
* @param layout Layout value to set
*/
void setLayout(Layout layout);
/**
* @brief changes dims and layout at same time
*
* @param dims new dimensions
* @param layout new layout
*/
void reshape(const SizeVector& dims, Layout layout);
/**
* @deprecated Use InferenceEngine::Data::reshape(const SizeVector&, Layout)
* @brief changes dims and layout at same time
*
* @param dims new dimensions
* @param layout new layout
*/
INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::Data::reshape(const SizeVector&, Layout)")
void reshape(const std::initializer_list<size_t>& dims, Layout layout);
/**
* @brief Gets the layout value for this Data instance
* @return Layout
*/
Layout getLayout() const;
/**
* @brief Gets Tensor descriptor reference
*
* @return reference to TensorDesc
*/
const TensorDesc& getTensorDesc() const;
/**
* @brief Gets a precision type of this Data instance
*
* @return Precision type
*/
const Precision& getPrecision() const;
/**
* @brief Sets a precision type of this Data instance
*
* @param precision Precision of the data
*/
void setPrecision(const Precision& precision);
/**
* @return data dimensions
*/
const SizeVector& getDims() const;
/**
* @return name of the data object
*/
const std::string& getName() const;
/**
* @brief Sets a name the Data object
*
* @param newName Name of the data node
*/
void setName(const std::string& newName);
/**
* @return convenient arbitrary user data holder
*/
const UserValue& getUserObject() const;
/**
* @private
* @brief Don't touch this field. An implementation details for Data object.
*/
std::shared_ptr<Impl> _impl;
private:
/**
* @brief A unique name that identifies this data node
*/
std::string name;
/**
* @brief A user utility place holder
*/
UserValue userObject;
/**
* @brief A tensor descriptor
*/
mutable TensorDesc tensorDesc;
};
IE_SUPPRESS_DEPRECATED_END
} // namespace InferenceEngine