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
378
379
380
381
382
383
384
385
386
387
|
// 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 TensorDimBuilder;
struct Tensor;
struct TensorBuilder;
/// ----------------------------------------------------------------------
/// Data structures for dense tensors
/// Shape data for a single axis in a tensor
struct TensorDim FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef TensorDimBuilder Builder;
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 {
typedef TensorDim Table;
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 {
typedef TensorBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_TYPE_TYPE = 4,
VT_TYPE = 6,
VT_SHAPE = 8,
VT_STRIDES = 10,
VT_DATA = 12
};
org::apache::arrow::flatbuf::Type type_type() const {
return static_cast<org::apache::arrow::flatbuf::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 org::apache::arrow::flatbuf::Null *type_as_Null() const {
return type_type() == org::apache::arrow::flatbuf::Type::Null ? static_cast<const org::apache::arrow::flatbuf::Null *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Int *type_as_Int() const {
return type_type() == org::apache::arrow::flatbuf::Type::Int ? static_cast<const org::apache::arrow::flatbuf::Int *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::FloatingPoint *type_as_FloatingPoint() const {
return type_type() == org::apache::arrow::flatbuf::Type::FloatingPoint ? static_cast<const org::apache::arrow::flatbuf::FloatingPoint *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Binary *type_as_Binary() const {
return type_type() == org::apache::arrow::flatbuf::Type::Binary ? static_cast<const org::apache::arrow::flatbuf::Binary *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Utf8 *type_as_Utf8() const {
return type_type() == org::apache::arrow::flatbuf::Type::Utf8 ? static_cast<const org::apache::arrow::flatbuf::Utf8 *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Bool *type_as_Bool() const {
return type_type() == org::apache::arrow::flatbuf::Type::Bool ? static_cast<const org::apache::arrow::flatbuf::Bool *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Decimal *type_as_Decimal() const {
return type_type() == org::apache::arrow::flatbuf::Type::Decimal ? static_cast<const org::apache::arrow::flatbuf::Decimal *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Date *type_as_Date() const {
return type_type() == org::apache::arrow::flatbuf::Type::Date ? static_cast<const org::apache::arrow::flatbuf::Date *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Time *type_as_Time() const {
return type_type() == org::apache::arrow::flatbuf::Type::Time ? static_cast<const org::apache::arrow::flatbuf::Time *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Timestamp *type_as_Timestamp() const {
return type_type() == org::apache::arrow::flatbuf::Type::Timestamp ? static_cast<const org::apache::arrow::flatbuf::Timestamp *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Interval *type_as_Interval() const {
return type_type() == org::apache::arrow::flatbuf::Type::Interval ? static_cast<const org::apache::arrow::flatbuf::Interval *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::List *type_as_List() const {
return type_type() == org::apache::arrow::flatbuf::Type::List ? static_cast<const org::apache::arrow::flatbuf::List *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Struct_ *type_as_Struct_() const {
return type_type() == org::apache::arrow::flatbuf::Type::Struct_ ? static_cast<const org::apache::arrow::flatbuf::Struct_ *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Union *type_as_Union() const {
return type_type() == org::apache::arrow::flatbuf::Type::Union ? static_cast<const org::apache::arrow::flatbuf::Union *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::FixedSizeBinary *type_as_FixedSizeBinary() const {
return type_type() == org::apache::arrow::flatbuf::Type::FixedSizeBinary ? static_cast<const org::apache::arrow::flatbuf::FixedSizeBinary *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::FixedSizeList *type_as_FixedSizeList() const {
return type_type() == org::apache::arrow::flatbuf::Type::FixedSizeList ? static_cast<const org::apache::arrow::flatbuf::FixedSizeList *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Map *type_as_Map() const {
return type_type() == org::apache::arrow::flatbuf::Type::Map ? static_cast<const org::apache::arrow::flatbuf::Map *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::Duration *type_as_Duration() const {
return type_type() == org::apache::arrow::flatbuf::Type::Duration ? static_cast<const org::apache::arrow::flatbuf::Duration *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::LargeBinary *type_as_LargeBinary() const {
return type_type() == org::apache::arrow::flatbuf::Type::LargeBinary ? static_cast<const org::apache::arrow::flatbuf::LargeBinary *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::LargeUtf8 *type_as_LargeUtf8() const {
return type_type() == org::apache::arrow::flatbuf::Type::LargeUtf8 ? static_cast<const org::apache::arrow::flatbuf::LargeUtf8 *>(type()) : nullptr;
}
const org::apache::arrow::flatbuf::LargeList *type_as_LargeList() const {
return type_type() == org::apache::arrow::flatbuf::Type::LargeList ? static_cast<const org::apache::arrow::flatbuf::LargeList *>(type()) : nullptr;
}
/// The dimensions of the tensor, optionally named
const flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::TensorDim>> *shape() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::TensorDim>> *>(VT_SHAPE);
}
/// Non-negative byte offsets to advance one value cell along each dimension
/// If omitted, default to row-major order (C-like).
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 org::apache::arrow::flatbuf::Buffer *data() const {
return GetStruct<const org::apache::arrow::flatbuf::Buffer *>(VT_DATA);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint8_t>(verifier, VT_TYPE_TYPE) &&
VerifyOffsetRequired(verifier, VT_TYPE) &&
VerifyType(verifier, type(), type_type()) &&
VerifyOffsetRequired(verifier, VT_SHAPE) &&
verifier.VerifyVector(shape()) &&
verifier.VerifyVectorOfTables(shape()) &&
VerifyOffset(verifier, VT_STRIDES) &&
verifier.VerifyVector(strides()) &&
VerifyFieldRequired<org::apache::arrow::flatbuf::Buffer>(verifier, VT_DATA) &&
verifier.EndTable();
}
};
template<> inline const org::apache::arrow::flatbuf::Null *Tensor::type_as<org::apache::arrow::flatbuf::Null>() const {
return type_as_Null();
}
template<> inline const org::apache::arrow::flatbuf::Int *Tensor::type_as<org::apache::arrow::flatbuf::Int>() const {
return type_as_Int();
}
template<> inline const org::apache::arrow::flatbuf::FloatingPoint *Tensor::type_as<org::apache::arrow::flatbuf::FloatingPoint>() const {
return type_as_FloatingPoint();
}
template<> inline const org::apache::arrow::flatbuf::Binary *Tensor::type_as<org::apache::arrow::flatbuf::Binary>() const {
return type_as_Binary();
}
template<> inline const org::apache::arrow::flatbuf::Utf8 *Tensor::type_as<org::apache::arrow::flatbuf::Utf8>() const {
return type_as_Utf8();
}
template<> inline const org::apache::arrow::flatbuf::Bool *Tensor::type_as<org::apache::arrow::flatbuf::Bool>() const {
return type_as_Bool();
}
template<> inline const org::apache::arrow::flatbuf::Decimal *Tensor::type_as<org::apache::arrow::flatbuf::Decimal>() const {
return type_as_Decimal();
}
template<> inline const org::apache::arrow::flatbuf::Date *Tensor::type_as<org::apache::arrow::flatbuf::Date>() const {
return type_as_Date();
}
template<> inline const org::apache::arrow::flatbuf::Time *Tensor::type_as<org::apache::arrow::flatbuf::Time>() const {
return type_as_Time();
}
template<> inline const org::apache::arrow::flatbuf::Timestamp *Tensor::type_as<org::apache::arrow::flatbuf::Timestamp>() const {
return type_as_Timestamp();
}
template<> inline const org::apache::arrow::flatbuf::Interval *Tensor::type_as<org::apache::arrow::flatbuf::Interval>() const {
return type_as_Interval();
}
template<> inline const org::apache::arrow::flatbuf::List *Tensor::type_as<org::apache::arrow::flatbuf::List>() const {
return type_as_List();
}
template<> inline const org::apache::arrow::flatbuf::Struct_ *Tensor::type_as<org::apache::arrow::flatbuf::Struct_>() const {
return type_as_Struct_();
}
template<> inline const org::apache::arrow::flatbuf::Union *Tensor::type_as<org::apache::arrow::flatbuf::Union>() const {
return type_as_Union();
}
template<> inline const org::apache::arrow::flatbuf::FixedSizeBinary *Tensor::type_as<org::apache::arrow::flatbuf::FixedSizeBinary>() const {
return type_as_FixedSizeBinary();
}
template<> inline const org::apache::arrow::flatbuf::FixedSizeList *Tensor::type_as<org::apache::arrow::flatbuf::FixedSizeList>() const {
return type_as_FixedSizeList();
}
template<> inline const org::apache::arrow::flatbuf::Map *Tensor::type_as<org::apache::arrow::flatbuf::Map>() const {
return type_as_Map();
}
template<> inline const org::apache::arrow::flatbuf::Duration *Tensor::type_as<org::apache::arrow::flatbuf::Duration>() const {
return type_as_Duration();
}
template<> inline const org::apache::arrow::flatbuf::LargeBinary *Tensor::type_as<org::apache::arrow::flatbuf::LargeBinary>() const {
return type_as_LargeBinary();
}
template<> inline const org::apache::arrow::flatbuf::LargeUtf8 *Tensor::type_as<org::apache::arrow::flatbuf::LargeUtf8>() const {
return type_as_LargeUtf8();
}
template<> inline const org::apache::arrow::flatbuf::LargeList *Tensor::type_as<org::apache::arrow::flatbuf::LargeList>() const {
return type_as_LargeList();
}
struct TensorBuilder {
typedef Tensor Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_type_type(org::apache::arrow::flatbuf::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<org::apache::arrow::flatbuf::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 org::apache::arrow::flatbuf::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);
fbb_.Required(o, Tensor::VT_TYPE);
fbb_.Required(o, Tensor::VT_SHAPE);
fbb_.Required(o, Tensor::VT_DATA);
return o;
}
};
inline flatbuffers::Offset<Tensor> CreateTensor(
flatbuffers::FlatBufferBuilder &_fbb,
org::apache::arrow::flatbuf::Type type_type = org::apache::arrow::flatbuf::Type::NONE,
flatbuffers::Offset<void> type = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<org::apache::arrow::flatbuf::TensorDim>>> shape = 0,
flatbuffers::Offset<flatbuffers::Vector<int64_t>> strides = 0,
const org::apache::arrow::flatbuf::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,
org::apache::arrow::flatbuf::Type type_type = org::apache::arrow::flatbuf::Type::NONE,
flatbuffers::Offset<void> type = 0,
const std::vector<flatbuffers::Offset<org::apache::arrow::flatbuf::TensorDim>> *shape = nullptr,
const std::vector<int64_t> *strides = nullptr,
const org::apache::arrow::flatbuf::Buffer *data = 0) {
auto shape__ = shape ? _fbb.CreateVector<flatbuffers::Offset<org::apache::arrow::flatbuf::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_
|