448 lines
13 KiB
C++
448 lines
13 KiB
C++
// automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
|
|
#ifndef FLATBUFFERS_GENERATED_ARRAY_GRAPH_H_
|
|
#define FLATBUFFERS_GENERATED_ARRAY_GRAPH_H_
|
|
|
|
#include "flatbuffers/flatbuffers.h"
|
|
|
|
// Ensure the included flatbuffers.h is the same version as when this file was
|
|
// generated, otherwise it may not be compatible.
|
|
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
|
FLATBUFFERS_VERSION_MINOR == 2 &&
|
|
FLATBUFFERS_VERSION_REVISION == 10,
|
|
"Non-compatible flatbuffers version included");
|
|
|
|
namespace graph {
|
|
|
|
struct BufferChunk;
|
|
struct BufferChunkBuilder;
|
|
|
|
struct FlatArray;
|
|
struct FlatArrayBuilder;
|
|
|
|
enum ByteOrder : int8_t {
|
|
ByteOrder_LE = 0,
|
|
ByteOrder_BE = 1,
|
|
ByteOrder_MIN = ByteOrder_LE,
|
|
ByteOrder_MAX = ByteOrder_BE
|
|
};
|
|
|
|
inline const ByteOrder (&EnumValuesByteOrder())[2] {
|
|
static const ByteOrder values[] = {
|
|
ByteOrder_LE,
|
|
ByteOrder_BE
|
|
};
|
|
return values;
|
|
}
|
|
|
|
inline const char * const *EnumNamesByteOrder() {
|
|
static const char * const names[3] = {
|
|
"LE",
|
|
"BE",
|
|
nullptr
|
|
};
|
|
return names;
|
|
}
|
|
|
|
inline const char *EnumNameByteOrder(ByteOrder e) {
|
|
if (::flatbuffers::IsOutRange(e, ByteOrder_LE, ByteOrder_BE)) return "";
|
|
const size_t index = static_cast<size_t>(e);
|
|
return EnumNamesByteOrder()[index];
|
|
}
|
|
|
|
enum DType : int8_t {
|
|
DType_INHERIT = 0,
|
|
DType_BOOL = 1,
|
|
DType_FLOAT8 = 2,
|
|
DType_HALF = 3,
|
|
DType_HALF2 = 4,
|
|
DType_FLOAT = 5,
|
|
DType_DOUBLE = 6,
|
|
DType_INT8 = 7,
|
|
DType_INT16 = 8,
|
|
DType_INT32 = 9,
|
|
DType_INT64 = 10,
|
|
DType_UINT8 = 11,
|
|
DType_UINT16 = 12,
|
|
DType_UINT32 = 13,
|
|
DType_UINT64 = 14,
|
|
DType_QINT8 = 15,
|
|
DType_QINT16 = 16,
|
|
DType_BFLOAT16 = 17,
|
|
DType_UTF8 = 50,
|
|
DType_UTF16 = 51,
|
|
DType_UTF32 = 52,
|
|
DType_MIN = DType_INHERIT,
|
|
DType_MAX = DType_UTF32
|
|
};
|
|
|
|
inline const DType (&EnumValuesDType())[21] {
|
|
static const DType values[] = {
|
|
DType_INHERIT,
|
|
DType_BOOL,
|
|
DType_FLOAT8,
|
|
DType_HALF,
|
|
DType_HALF2,
|
|
DType_FLOAT,
|
|
DType_DOUBLE,
|
|
DType_INT8,
|
|
DType_INT16,
|
|
DType_INT32,
|
|
DType_INT64,
|
|
DType_UINT8,
|
|
DType_UINT16,
|
|
DType_UINT32,
|
|
DType_UINT64,
|
|
DType_QINT8,
|
|
DType_QINT16,
|
|
DType_BFLOAT16,
|
|
DType_UTF8,
|
|
DType_UTF16,
|
|
DType_UTF32
|
|
};
|
|
return values;
|
|
}
|
|
|
|
inline const char * const *EnumNamesDType() {
|
|
static const char * const names[54] = {
|
|
"INHERIT",
|
|
"BOOL",
|
|
"FLOAT8",
|
|
"HALF",
|
|
"HALF2",
|
|
"FLOAT",
|
|
"DOUBLE",
|
|
"INT8",
|
|
"INT16",
|
|
"INT32",
|
|
"INT64",
|
|
"UINT8",
|
|
"UINT16",
|
|
"UINT32",
|
|
"UINT64",
|
|
"QINT8",
|
|
"QINT16",
|
|
"BFLOAT16",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"UTF8",
|
|
"UTF16",
|
|
"UTF32",
|
|
nullptr
|
|
};
|
|
return names;
|
|
}
|
|
|
|
inline const char *EnumNameDType(DType e) {
|
|
if (::flatbuffers::IsOutRange(e, DType_INHERIT, DType_UTF32)) return "";
|
|
const size_t index = static_cast<size_t>(e);
|
|
return EnumNamesDType()[index];
|
|
}
|
|
|
|
enum LossReduce : int8_t {
|
|
LossReduce_NONE = 0,
|
|
LossReduce_SUM = 1,
|
|
LossReduce_MEAN_BY_WEIGHT = 2,
|
|
LossReduce_MEAN_BY_NONZERO_WEIGHT_COUNT = 3,
|
|
LossReduce_MIN = LossReduce_NONE,
|
|
LossReduce_MAX = LossReduce_MEAN_BY_NONZERO_WEIGHT_COUNT
|
|
};
|
|
|
|
inline const LossReduce (&EnumValuesLossReduce())[4] {
|
|
static const LossReduce values[] = {
|
|
LossReduce_NONE,
|
|
LossReduce_SUM,
|
|
LossReduce_MEAN_BY_WEIGHT,
|
|
LossReduce_MEAN_BY_NONZERO_WEIGHT_COUNT
|
|
};
|
|
return values;
|
|
}
|
|
|
|
inline const char * const *EnumNamesLossReduce() {
|
|
static const char * const names[5] = {
|
|
"NONE",
|
|
"SUM",
|
|
"MEAN_BY_WEIGHT",
|
|
"MEAN_BY_NONZERO_WEIGHT_COUNT",
|
|
nullptr
|
|
};
|
|
return names;
|
|
}
|
|
|
|
inline const char *EnumNameLossReduce(LossReduce e) {
|
|
if (::flatbuffers::IsOutRange(e, LossReduce_NONE, LossReduce_MEAN_BY_NONZERO_WEIGHT_COUNT)) return "";
|
|
const size_t index = static_cast<size_t>(e);
|
|
return EnumNamesLossReduce()[index];
|
|
}
|
|
|
|
struct BufferChunk FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
|
typedef BufferChunkBuilder Builder;
|
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
|
VT_INDEX = 4,
|
|
VT_DATA = 6
|
|
};
|
|
int64_t index() const {
|
|
return GetField<int64_t>(VT_INDEX, 0);
|
|
}
|
|
const ::flatbuffers::Vector<int8_t> *data() const {
|
|
return GetPointer<const ::flatbuffers::Vector<int8_t> *>(VT_DATA);
|
|
}
|
|
bool Verify(::flatbuffers::Verifier &verifier) const {
|
|
return VerifyTableStart(verifier) &&
|
|
VerifyField<int64_t>(verifier, VT_INDEX, 8) &&
|
|
VerifyOffset(verifier, VT_DATA) &&
|
|
verifier.VerifyVector(data()) &&
|
|
verifier.EndTable();
|
|
}
|
|
};
|
|
|
|
struct BufferChunkBuilder {
|
|
typedef BufferChunk Table;
|
|
::flatbuffers::FlatBufferBuilder &fbb_;
|
|
::flatbuffers::uoffset_t start_;
|
|
void add_index(int64_t index) {
|
|
fbb_.AddElement<int64_t>(BufferChunk::VT_INDEX, index, 0);
|
|
}
|
|
void add_data(::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> data) {
|
|
fbb_.AddOffset(BufferChunk::VT_DATA, data);
|
|
}
|
|
explicit BufferChunkBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
|
: fbb_(_fbb) {
|
|
start_ = fbb_.StartTable();
|
|
}
|
|
::flatbuffers::Offset<BufferChunk> Finish() {
|
|
const auto end = fbb_.EndTable(start_);
|
|
auto o = ::flatbuffers::Offset<BufferChunk>(end);
|
|
return o;
|
|
}
|
|
};
|
|
|
|
inline ::flatbuffers::Offset<BufferChunk> CreateBufferChunk(
|
|
::flatbuffers::FlatBufferBuilder &_fbb,
|
|
int64_t index = 0,
|
|
::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> data = 0) {
|
|
BufferChunkBuilder builder_(_fbb);
|
|
builder_.add_index(index);
|
|
builder_.add_data(data);
|
|
return builder_.Finish();
|
|
}
|
|
|
|
inline ::flatbuffers::Offset<BufferChunk> CreateBufferChunkDirect(
|
|
::flatbuffers::FlatBufferBuilder &_fbb,
|
|
int64_t index = 0,
|
|
const std::vector<int8_t> *data = nullptr) {
|
|
auto data__ = data ? _fbb.CreateVector<int8_t>(*data) : 0;
|
|
return graph::CreateBufferChunk(
|
|
_fbb,
|
|
index,
|
|
data__);
|
|
}
|
|
|
|
struct FlatArray FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
|
typedef FlatArrayBuilder Builder;
|
|
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
|
VT_SHAPE = 4,
|
|
VT_BUFFER = 6,
|
|
VT_DTYPE = 8,
|
|
VT_BYTEORDER = 10,
|
|
VT_BUFFERCHUNKS = 12,
|
|
VT_TOTALBUFFERSIZE = 14,
|
|
VT_EXTERNALDATAFILENAME = 16,
|
|
VT_ISEXTERNAL = 18
|
|
};
|
|
const ::flatbuffers::Vector<int64_t> *shape() const {
|
|
return GetPointer<const ::flatbuffers::Vector<int64_t> *>(VT_SHAPE);
|
|
}
|
|
const ::flatbuffers::Vector<int8_t> *buffer() const {
|
|
return GetPointer<const ::flatbuffers::Vector<int8_t> *>(VT_BUFFER);
|
|
}
|
|
graph::DType dtype() const {
|
|
return static_cast<graph::DType>(GetField<int8_t>(VT_DTYPE, 0));
|
|
}
|
|
graph::ByteOrder byteOrder() const {
|
|
return static_cast<graph::ByteOrder>(GetField<int8_t>(VT_BYTEORDER, 0));
|
|
}
|
|
const ::flatbuffers::Vector<::flatbuffers::Offset<graph::BufferChunk>> *bufferChunks() const {
|
|
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<graph::BufferChunk>> *>(VT_BUFFERCHUNKS);
|
|
}
|
|
int64_t totalBufferSize() const {
|
|
return GetField<int64_t>(VT_TOTALBUFFERSIZE, 0);
|
|
}
|
|
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *externalDataFilename() const {
|
|
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_EXTERNALDATAFILENAME);
|
|
}
|
|
bool isExternal() const {
|
|
return GetField<uint8_t>(VT_ISEXTERNAL, 0) != 0;
|
|
}
|
|
bool Verify(::flatbuffers::Verifier &verifier) const {
|
|
return VerifyTableStart(verifier) &&
|
|
VerifyOffset(verifier, VT_SHAPE) &&
|
|
verifier.VerifyVector(shape()) &&
|
|
VerifyOffset(verifier, VT_BUFFER) &&
|
|
verifier.VerifyVector(buffer()) &&
|
|
VerifyField<int8_t>(verifier, VT_DTYPE, 1) &&
|
|
VerifyField<int8_t>(verifier, VT_BYTEORDER, 1) &&
|
|
VerifyOffset(verifier, VT_BUFFERCHUNKS) &&
|
|
verifier.VerifyVector(bufferChunks()) &&
|
|
verifier.VerifyVectorOfTables(bufferChunks()) &&
|
|
VerifyField<int64_t>(verifier, VT_TOTALBUFFERSIZE, 8) &&
|
|
VerifyOffset(verifier, VT_EXTERNALDATAFILENAME) &&
|
|
verifier.VerifyVector(externalDataFilename()) &&
|
|
verifier.VerifyVectorOfStrings(externalDataFilename()) &&
|
|
VerifyField<uint8_t>(verifier, VT_ISEXTERNAL, 1) &&
|
|
verifier.EndTable();
|
|
}
|
|
};
|
|
|
|
struct FlatArrayBuilder {
|
|
typedef FlatArray Table;
|
|
::flatbuffers::FlatBufferBuilder &fbb_;
|
|
::flatbuffers::uoffset_t start_;
|
|
void add_shape(::flatbuffers::Offset<::flatbuffers::Vector<int64_t>> shape) {
|
|
fbb_.AddOffset(FlatArray::VT_SHAPE, shape);
|
|
}
|
|
void add_buffer(::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> buffer) {
|
|
fbb_.AddOffset(FlatArray::VT_BUFFER, buffer);
|
|
}
|
|
void add_dtype(graph::DType dtype) {
|
|
fbb_.AddElement<int8_t>(FlatArray::VT_DTYPE, static_cast<int8_t>(dtype), 0);
|
|
}
|
|
void add_byteOrder(graph::ByteOrder byteOrder) {
|
|
fbb_.AddElement<int8_t>(FlatArray::VT_BYTEORDER, static_cast<int8_t>(byteOrder), 0);
|
|
}
|
|
void add_bufferChunks(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::BufferChunk>>> bufferChunks) {
|
|
fbb_.AddOffset(FlatArray::VT_BUFFERCHUNKS, bufferChunks);
|
|
}
|
|
void add_totalBufferSize(int64_t totalBufferSize) {
|
|
fbb_.AddElement<int64_t>(FlatArray::VT_TOTALBUFFERSIZE, totalBufferSize, 0);
|
|
}
|
|
void add_externalDataFilename(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> externalDataFilename) {
|
|
fbb_.AddOffset(FlatArray::VT_EXTERNALDATAFILENAME, externalDataFilename);
|
|
}
|
|
void add_isExternal(bool isExternal) {
|
|
fbb_.AddElement<uint8_t>(FlatArray::VT_ISEXTERNAL, static_cast<uint8_t>(isExternal), 0);
|
|
}
|
|
explicit FlatArrayBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
|
: fbb_(_fbb) {
|
|
start_ = fbb_.StartTable();
|
|
}
|
|
::flatbuffers::Offset<FlatArray> Finish() {
|
|
const auto end = fbb_.EndTable(start_);
|
|
auto o = ::flatbuffers::Offset<FlatArray>(end);
|
|
return o;
|
|
}
|
|
};
|
|
|
|
inline ::flatbuffers::Offset<FlatArray> CreateFlatArray(
|
|
::flatbuffers::FlatBufferBuilder &_fbb,
|
|
::flatbuffers::Offset<::flatbuffers::Vector<int64_t>> shape = 0,
|
|
::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> buffer = 0,
|
|
graph::DType dtype = graph::DType_INHERIT,
|
|
graph::ByteOrder byteOrder = graph::ByteOrder_LE,
|
|
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::BufferChunk>>> bufferChunks = 0,
|
|
int64_t totalBufferSize = 0,
|
|
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> externalDataFilename = 0,
|
|
bool isExternal = false) {
|
|
FlatArrayBuilder builder_(_fbb);
|
|
builder_.add_totalBufferSize(totalBufferSize);
|
|
builder_.add_externalDataFilename(externalDataFilename);
|
|
builder_.add_bufferChunks(bufferChunks);
|
|
builder_.add_buffer(buffer);
|
|
builder_.add_shape(shape);
|
|
builder_.add_isExternal(isExternal);
|
|
builder_.add_byteOrder(byteOrder);
|
|
builder_.add_dtype(dtype);
|
|
return builder_.Finish();
|
|
}
|
|
|
|
inline ::flatbuffers::Offset<FlatArray> CreateFlatArrayDirect(
|
|
::flatbuffers::FlatBufferBuilder &_fbb,
|
|
const std::vector<int64_t> *shape = nullptr,
|
|
const std::vector<int8_t> *buffer = nullptr,
|
|
graph::DType dtype = graph::DType_INHERIT,
|
|
graph::ByteOrder byteOrder = graph::ByteOrder_LE,
|
|
const std::vector<::flatbuffers::Offset<graph::BufferChunk>> *bufferChunks = nullptr,
|
|
int64_t totalBufferSize = 0,
|
|
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *externalDataFilename = nullptr,
|
|
bool isExternal = false) {
|
|
auto shape__ = shape ? _fbb.CreateVector<int64_t>(*shape) : 0;
|
|
auto buffer__ = buffer ? _fbb.CreateVector<int8_t>(*buffer) : 0;
|
|
auto bufferChunks__ = bufferChunks ? _fbb.CreateVector<::flatbuffers::Offset<graph::BufferChunk>>(*bufferChunks) : 0;
|
|
auto externalDataFilename__ = externalDataFilename ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*externalDataFilename) : 0;
|
|
return graph::CreateFlatArray(
|
|
_fbb,
|
|
shape__,
|
|
buffer__,
|
|
dtype,
|
|
byteOrder,
|
|
bufferChunks__,
|
|
totalBufferSize,
|
|
externalDataFilename__,
|
|
isExternal);
|
|
}
|
|
|
|
inline const graph::FlatArray *GetFlatArray(const void *buf) {
|
|
return ::flatbuffers::GetRoot<graph::FlatArray>(buf);
|
|
}
|
|
|
|
inline const graph::FlatArray *GetSizePrefixedFlatArray(const void *buf) {
|
|
return ::flatbuffers::GetSizePrefixedRoot<graph::FlatArray>(buf);
|
|
}
|
|
|
|
inline bool VerifyFlatArrayBuffer(
|
|
::flatbuffers::Verifier &verifier) {
|
|
return verifier.VerifyBuffer<graph::FlatArray>(nullptr);
|
|
}
|
|
|
|
inline bool VerifySizePrefixedFlatArrayBuffer(
|
|
::flatbuffers::Verifier &verifier) {
|
|
return verifier.VerifySizePrefixedBuffer<graph::FlatArray>(nullptr);
|
|
}
|
|
|
|
inline void FinishFlatArrayBuffer(
|
|
::flatbuffers::FlatBufferBuilder &fbb,
|
|
::flatbuffers::Offset<graph::FlatArray> root) {
|
|
fbb.Finish(root);
|
|
}
|
|
|
|
inline void FinishSizePrefixedFlatArrayBuffer(
|
|
::flatbuffers::FlatBufferBuilder &fbb,
|
|
::flatbuffers::Offset<graph::FlatArray> root) {
|
|
fbb.FinishSizePrefixed(root);
|
|
}
|
|
|
|
} // namespace graph
|
|
|
|
#endif // FLATBUFFERS_GENERATED_ARRAY_GRAPH_H_
|