forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTensor_generated.h
More file actions
377 lines (333 loc) · 12.3 KB
/
Copy pathTensor_generated.h
File metadata and controls
377 lines (333 loc) · 12.3 KB
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
// automatically generated by the FlatBuffers compiler, do not modify
#ifndef FLATBUFFERS_GENERATED_TENSOR_ORG_APACHE_ARROW_FLATBUF_H_
#define FLATBUFFERS_GENERATED_TENSOR_ORG_APACHE_ARROW_FLATBUF_H_
#include "flatbuffers/flatbuffers.h"
#include "Schema_generated.h"
namespace org {
namespace apache {
namespace arrow {
namespace flatbuf {
struct TensorDim;
struct Tensor;
/// ----------------------------------------------------------------------
/// Data structures for dense tensors
/// Shape data for a single axis in a tensor
struct TensorDim FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_SIZE = 4,
VT_NAME = 6
};
/// Length of dimension
int64_t size() const {
return GetField<int64_t>(VT_SIZE, 0);
}
/// Name of the dimension, optional
const flatbuffers::String *name() const {
return GetPointer<const flatbuffers::String *>(VT_NAME);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<int64_t>(verifier, VT_SIZE) &&
VerifyOffset(verifier, VT_NAME) &&
verifier.VerifyString(name()) &&
verifier.EndTable();
}
};
struct TensorDimBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_size(int64_t size) {
fbb_.AddElement<int64_t>(TensorDim::VT_SIZE, size, 0);
}
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
fbb_.AddOffset(TensorDim::VT_NAME, name);
}
explicit TensorDimBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
TensorDimBuilder &operator=(const TensorDimBuilder &);
flatbuffers::Offset<TensorDim> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TensorDim>(end);
return o;
}
};
inline flatbuffers::Offset<TensorDim> CreateTensorDim(
flatbuffers::FlatBufferBuilder &_fbb,
int64_t size = 0,
flatbuffers::Offset<flatbuffers::String> name = 0) {
TensorDimBuilder builder_(_fbb);
builder_.add_size(size);
builder_.add_name(name);
return builder_.Finish();
}
inline flatbuffers::Offset<TensorDim> CreateTensorDimDirect(
flatbuffers::FlatBufferBuilder &_fbb,
int64_t size = 0,
const char *name = nullptr) {
auto name__ = name ? _fbb.CreateString(name) : 0;
return org::apache::arrow::flatbuf::CreateTensorDim(
_fbb,
size,
name__);
}
struct Tensor FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_TYPE_TYPE = 4,
VT_TYPE = 6,
VT_SHAPE = 8,
VT_STRIDES = 10,
VT_DATA = 12
};
Type type_type() const {
return static_cast<Type>(GetField<uint8_t>(VT_TYPE_TYPE, 0));
}
/// The type of data contained in a value cell. Currently only fixed-width
/// value types are supported, no strings or nested types
const void *type() const {
return GetPointer<const void *>(VT_TYPE);
}
template<typename T> const T *type_as() const;
const Null *type_as_Null() const {
return type_type() == Type_Null ? static_cast<const Null *>(type()) : nullptr;
}
const Int *type_as_Int() const {
return type_type() == Type_Int ? static_cast<const Int *>(type()) : nullptr;
}
const FloatingPoint *type_as_FloatingPoint() const {
return type_type() == Type_FloatingPoint ? static_cast<const FloatingPoint *>(type()) : nullptr;
}
const Binary *type_as_Binary() const {
return type_type() == Type_Binary ? static_cast<const Binary *>(type()) : nullptr;
}
const Utf8 *type_as_Utf8() const {
return type_type() == Type_Utf8 ? static_cast<const Utf8 *>(type()) : nullptr;
}
const Bool *type_as_Bool() const {
return type_type() == Type_Bool ? static_cast<const Bool *>(type()) : nullptr;
}
const Decimal *type_as_Decimal() const {
return type_type() == Type_Decimal ? static_cast<const Decimal *>(type()) : nullptr;
}
const Date *type_as_Date() const {
return type_type() == Type_Date ? static_cast<const Date *>(type()) : nullptr;
}
const Time *type_as_Time() const {
return type_type() == Type_Time ? static_cast<const Time *>(type()) : nullptr;
}
const Timestamp *type_as_Timestamp() const {
return type_type() == Type_Timestamp ? static_cast<const Timestamp *>(type()) : nullptr;
}
const Interval *type_as_Interval() const {
return type_type() == Type_Interval ? static_cast<const Interval *>(type()) : nullptr;
}
const List *type_as_List() const {
return type_type() == Type_List ? static_cast<const List *>(type()) : nullptr;
}
const Struct_ *type_as_Struct_() const {
return type_type() == Type_Struct_ ? static_cast<const Struct_ *>(type()) : nullptr;
}
const Union *type_as_Union() const {
return type_type() == Type_Union ? static_cast<const Union *>(type()) : nullptr;
}
const FixedSizeBinary *type_as_FixedSizeBinary() const {
return type_type() == Type_FixedSizeBinary ? static_cast<const FixedSizeBinary *>(type()) : nullptr;
}
const FixedSizeList *type_as_FixedSizeList() const {
return type_type() == Type_FixedSizeList ? static_cast<const FixedSizeList *>(type()) : nullptr;
}
const Map *type_as_Map() const {
return type_type() == Type_Map ? static_cast<const Map *>(type()) : nullptr;
}
const Duration *type_as_Duration() const {
return type_type() == Type_Duration ? static_cast<const Duration *>(type()) : nullptr;
}
const LargeBinary *type_as_LargeBinary() const {
return type_type() == Type_LargeBinary ? static_cast<const LargeBinary *>(type()) : nullptr;
}
const LargeUtf8 *type_as_LargeUtf8() const {
return type_type() == Type_LargeUtf8 ? static_cast<const LargeUtf8 *>(type()) : nullptr;
}
const LargeList *type_as_LargeList() const {
return type_type() == Type_LargeList ? static_cast<const LargeList *>(type()) : nullptr;
}
/// The dimensions of the tensor, optionally named
const flatbuffers::Vector<flatbuffers::Offset<TensorDim>> *shape() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<TensorDim>> *>(VT_SHAPE);
}
/// Non-negative byte offsets to advance one value cell along each dimension
const flatbuffers::Vector<int64_t> *strides() const {
return GetPointer<const flatbuffers::Vector<int64_t> *>(VT_STRIDES);
}
/// The location and size of the tensor's data
const Buffer *data() const {
return GetStruct<const Buffer *>(VT_DATA);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint8_t>(verifier, VT_TYPE_TYPE) &&
VerifyOffset(verifier, VT_TYPE) &&
VerifyType(verifier, type(), type_type()) &&
VerifyOffset(verifier, VT_SHAPE) &&
verifier.VerifyVector(shape()) &&
verifier.VerifyVectorOfTables(shape()) &&
VerifyOffset(verifier, VT_STRIDES) &&
verifier.VerifyVector(strides()) &&
VerifyField<Buffer>(verifier, VT_DATA) &&
verifier.EndTable();
}
};
template<> inline const Null *Tensor::type_as<Null>() const {
return type_as_Null();
}
template<> inline const Int *Tensor::type_as<Int>() const {
return type_as_Int();
}
template<> inline const FloatingPoint *Tensor::type_as<FloatingPoint>() const {
return type_as_FloatingPoint();
}
template<> inline const Binary *Tensor::type_as<Binary>() const {
return type_as_Binary();
}
template<> inline const Utf8 *Tensor::type_as<Utf8>() const {
return type_as_Utf8();
}
template<> inline const Bool *Tensor::type_as<Bool>() const {
return type_as_Bool();
}
template<> inline const Decimal *Tensor::type_as<Decimal>() const {
return type_as_Decimal();
}
template<> inline const Date *Tensor::type_as<Date>() const {
return type_as_Date();
}
template<> inline const Time *Tensor::type_as<Time>() const {
return type_as_Time();
}
template<> inline const Timestamp *Tensor::type_as<Timestamp>() const {
return type_as_Timestamp();
}
template<> inline const Interval *Tensor::type_as<Interval>() const {
return type_as_Interval();
}
template<> inline const List *Tensor::type_as<List>() const {
return type_as_List();
}
template<> inline const Struct_ *Tensor::type_as<Struct_>() const {
return type_as_Struct_();
}
template<> inline const Union *Tensor::type_as<Union>() const {
return type_as_Union();
}
template<> inline const FixedSizeBinary *Tensor::type_as<FixedSizeBinary>() const {
return type_as_FixedSizeBinary();
}
template<> inline const FixedSizeList *Tensor::type_as<FixedSizeList>() const {
return type_as_FixedSizeList();
}
template<> inline const Map *Tensor::type_as<Map>() const {
return type_as_Map();
}
template<> inline const Duration *Tensor::type_as<Duration>() const {
return type_as_Duration();
}
template<> inline const LargeBinary *Tensor::type_as<LargeBinary>() const {
return type_as_LargeBinary();
}
template<> inline const LargeUtf8 *Tensor::type_as<LargeUtf8>() const {
return type_as_LargeUtf8();
}
template<> inline const LargeList *Tensor::type_as<LargeList>() const {
return type_as_LargeList();
}
struct TensorBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_type_type(Type type_type) {
fbb_.AddElement<uint8_t>(Tensor::VT_TYPE_TYPE, static_cast<uint8_t>(type_type), 0);
}
void add_type(flatbuffers::Offset<void> type) {
fbb_.AddOffset(Tensor::VT_TYPE, type);
}
void add_shape(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<TensorDim>>> shape) {
fbb_.AddOffset(Tensor::VT_SHAPE, shape);
}
void add_strides(flatbuffers::Offset<flatbuffers::Vector<int64_t>> strides) {
fbb_.AddOffset(Tensor::VT_STRIDES, strides);
}
void add_data(const Buffer *data) {
fbb_.AddStruct(Tensor::VT_DATA, data);
}
explicit TensorBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
TensorBuilder &operator=(const TensorBuilder &);
flatbuffers::Offset<Tensor> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Tensor>(end);
return o;
}
};
inline flatbuffers::Offset<Tensor> CreateTensor(
flatbuffers::FlatBufferBuilder &_fbb,
Type type_type = Type_NONE,
flatbuffers::Offset<void> type = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<TensorDim>>> shape = 0,
flatbuffers::Offset<flatbuffers::Vector<int64_t>> strides = 0,
const Buffer *data = 0) {
TensorBuilder builder_(_fbb);
builder_.add_data(data);
builder_.add_strides(strides);
builder_.add_shape(shape);
builder_.add_type(type);
builder_.add_type_type(type_type);
return builder_.Finish();
}
inline flatbuffers::Offset<Tensor> CreateTensorDirect(
flatbuffers::FlatBufferBuilder &_fbb,
Type type_type = Type_NONE,
flatbuffers::Offset<void> type = 0,
const std::vector<flatbuffers::Offset<TensorDim>> *shape = nullptr,
const std::vector<int64_t> *strides = nullptr,
const Buffer *data = 0) {
auto shape__ = shape ? _fbb.CreateVector<flatbuffers::Offset<TensorDim>>(*shape) : 0;
auto strides__ = strides ? _fbb.CreateVector<int64_t>(*strides) : 0;
return org::apache::arrow::flatbuf::CreateTensor(
_fbb,
type_type,
type,
shape__,
strides__,
data);
}
inline const org::apache::arrow::flatbuf::Tensor *GetTensor(const void *buf) {
return flatbuffers::GetRoot<org::apache::arrow::flatbuf::Tensor>(buf);
}
inline const org::apache::arrow::flatbuf::Tensor *GetSizePrefixedTensor(const void *buf) {
return flatbuffers::GetSizePrefixedRoot<org::apache::arrow::flatbuf::Tensor>(buf);
}
inline bool VerifyTensorBuffer(
flatbuffers::Verifier &verifier) {
return verifier.VerifyBuffer<org::apache::arrow::flatbuf::Tensor>(nullptr);
}
inline bool VerifySizePrefixedTensorBuffer(
flatbuffers::Verifier &verifier) {
return verifier.VerifySizePrefixedBuffer<org::apache::arrow::flatbuf::Tensor>(nullptr);
}
inline void FinishTensorBuffer(
flatbuffers::FlatBufferBuilder &fbb,
flatbuffers::Offset<org::apache::arrow::flatbuf::Tensor> root) {
fbb.Finish(root);
}
inline void FinishSizePrefixedTensorBuffer(
flatbuffers::FlatBufferBuilder &fbb,
flatbuffers::Offset<org::apache::arrow::flatbuf::Tensor> root) {
fbb.FinishSizePrefixed(root);
}
} // namespace flatbuf
} // namespace arrow
} // namespace apache
} // namespace org
#endif // FLATBUFFERS_GENERATED_TENSOR_ORG_APACHE_ARROW_FLATBUF_H_