210 lines
6.2 KiB
C
210 lines
6.2 KiB
C
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||
|
|
||
|
|
||
|
#ifndef FLATBUFFERS_GENERATED_VARIABLE_ND4J_GRAPH_H_
|
||
|
#define FLATBUFFERS_GENERATED_VARIABLE_ND4J_GRAPH_H_
|
||
|
|
||
|
#include "flatbuffers/flatbuffers.h"
|
||
|
|
||
|
#include "array_generated.h"
|
||
|
#include "utils_generated.h"
|
||
|
|
||
|
namespace nd4j {
|
||
|
namespace graph {
|
||
|
|
||
|
struct FlatVariable;
|
||
|
|
||
|
enum VarType {
|
||
|
VarType_VARIABLE = 0,
|
||
|
VarType_CONSTANT = 1,
|
||
|
VarType_ARRAY = 2,
|
||
|
VarType_PLACEHOLDER = 3,
|
||
|
VarType_MIN = VarType_VARIABLE,
|
||
|
VarType_MAX = VarType_PLACEHOLDER
|
||
|
};
|
||
|
|
||
|
inline const VarType (&EnumValuesVarType())[4] {
|
||
|
static const VarType values[] = {
|
||
|
VarType_VARIABLE,
|
||
|
VarType_CONSTANT,
|
||
|
VarType_ARRAY,
|
||
|
VarType_PLACEHOLDER
|
||
|
};
|
||
|
return values;
|
||
|
}
|
||
|
|
||
|
inline const char * const *EnumNamesVarType() {
|
||
|
static const char * const names[] = {
|
||
|
"VARIABLE",
|
||
|
"CONSTANT",
|
||
|
"ARRAY",
|
||
|
"PLACEHOLDER",
|
||
|
nullptr
|
||
|
};
|
||
|
return names;
|
||
|
}
|
||
|
|
||
|
inline const char *EnumNameVarType(VarType e) {
|
||
|
const size_t index = static_cast<int>(e);
|
||
|
return EnumNamesVarType()[index];
|
||
|
}
|
||
|
|
||
|
struct FlatVariable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||
|
enum {
|
||
|
VT_ID = 4,
|
||
|
VT_NAME = 6,
|
||
|
VT_DTYPE = 8,
|
||
|
VT_SHAPE = 10,
|
||
|
VT_NDARRAY = 12,
|
||
|
VT_DEVICE = 14,
|
||
|
VT_VARIABLETYPE = 16
|
||
|
};
|
||
|
const IntPair *id() const {
|
||
|
return GetPointer<const IntPair *>(VT_ID);
|
||
|
}
|
||
|
const flatbuffers::String *name() const {
|
||
|
return GetPointer<const flatbuffers::String *>(VT_NAME);
|
||
|
}
|
||
|
DataType dtype() const {
|
||
|
return static_cast<DataType>(GetField<int8_t>(VT_DTYPE, 0));
|
||
|
}
|
||
|
const flatbuffers::Vector<int64_t> *shape() const {
|
||
|
return GetPointer<const flatbuffers::Vector<int64_t> *>(VT_SHAPE);
|
||
|
}
|
||
|
const FlatArray *ndarray() const {
|
||
|
return GetPointer<const FlatArray *>(VT_NDARRAY);
|
||
|
}
|
||
|
int32_t device() const {
|
||
|
return GetField<int32_t>(VT_DEVICE, 0);
|
||
|
}
|
||
|
VarType variabletype() const {
|
||
|
return static_cast<VarType>(GetField<int8_t>(VT_VARIABLETYPE, 0));
|
||
|
}
|
||
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||
|
return VerifyTableStart(verifier) &&
|
||
|
VerifyOffset(verifier, VT_ID) &&
|
||
|
verifier.VerifyTable(id()) &&
|
||
|
VerifyOffset(verifier, VT_NAME) &&
|
||
|
verifier.VerifyString(name()) &&
|
||
|
VerifyField<int8_t>(verifier, VT_DTYPE) &&
|
||
|
VerifyOffset(verifier, VT_SHAPE) &&
|
||
|
verifier.VerifyVector(shape()) &&
|
||
|
VerifyOffset(verifier, VT_NDARRAY) &&
|
||
|
verifier.VerifyTable(ndarray()) &&
|
||
|
VerifyField<int32_t>(verifier, VT_DEVICE) &&
|
||
|
VerifyField<int8_t>(verifier, VT_VARIABLETYPE) &&
|
||
|
verifier.EndTable();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
struct FlatVariableBuilder {
|
||
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||
|
flatbuffers::uoffset_t start_;
|
||
|
void add_id(flatbuffers::Offset<IntPair> id) {
|
||
|
fbb_.AddOffset(FlatVariable::VT_ID, id);
|
||
|
}
|
||
|
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
|
||
|
fbb_.AddOffset(FlatVariable::VT_NAME, name);
|
||
|
}
|
||
|
void add_dtype(DataType dtype) {
|
||
|
fbb_.AddElement<int8_t>(FlatVariable::VT_DTYPE, static_cast<int8_t>(dtype), 0);
|
||
|
}
|
||
|
void add_shape(flatbuffers::Offset<flatbuffers::Vector<int64_t>> shape) {
|
||
|
fbb_.AddOffset(FlatVariable::VT_SHAPE, shape);
|
||
|
}
|
||
|
void add_ndarray(flatbuffers::Offset<FlatArray> ndarray) {
|
||
|
fbb_.AddOffset(FlatVariable::VT_NDARRAY, ndarray);
|
||
|
}
|
||
|
void add_device(int32_t device) {
|
||
|
fbb_.AddElement<int32_t>(FlatVariable::VT_DEVICE, device, 0);
|
||
|
}
|
||
|
void add_variabletype(VarType variabletype) {
|
||
|
fbb_.AddElement<int8_t>(FlatVariable::VT_VARIABLETYPE, static_cast<int8_t>(variabletype), 0);
|
||
|
}
|
||
|
explicit FlatVariableBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
||
|
: fbb_(_fbb) {
|
||
|
start_ = fbb_.StartTable();
|
||
|
}
|
||
|
FlatVariableBuilder &operator=(const FlatVariableBuilder &);
|
||
|
flatbuffers::Offset<FlatVariable> Finish() {
|
||
|
const auto end = fbb_.EndTable(start_);
|
||
|
auto o = flatbuffers::Offset<FlatVariable>(end);
|
||
|
return o;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
inline flatbuffers::Offset<FlatVariable> CreateFlatVariable(
|
||
|
flatbuffers::FlatBufferBuilder &_fbb,
|
||
|
flatbuffers::Offset<IntPair> id = 0,
|
||
|
flatbuffers::Offset<flatbuffers::String> name = 0,
|
||
|
DataType dtype = DataType_INHERIT,
|
||
|
flatbuffers::Offset<flatbuffers::Vector<int64_t>> shape = 0,
|
||
|
flatbuffers::Offset<FlatArray> ndarray = 0,
|
||
|
int32_t device = 0,
|
||
|
VarType variabletype = VarType_VARIABLE) {
|
||
|
FlatVariableBuilder builder_(_fbb);
|
||
|
builder_.add_device(device);
|
||
|
builder_.add_ndarray(ndarray);
|
||
|
builder_.add_shape(shape);
|
||
|
builder_.add_name(name);
|
||
|
builder_.add_id(id);
|
||
|
builder_.add_variabletype(variabletype);
|
||
|
builder_.add_dtype(dtype);
|
||
|
return builder_.Finish();
|
||
|
}
|
||
|
|
||
|
inline flatbuffers::Offset<FlatVariable> CreateFlatVariableDirect(
|
||
|
flatbuffers::FlatBufferBuilder &_fbb,
|
||
|
flatbuffers::Offset<IntPair> id = 0,
|
||
|
const char *name = nullptr,
|
||
|
DataType dtype = DataType_INHERIT,
|
||
|
const std::vector<int64_t> *shape = nullptr,
|
||
|
flatbuffers::Offset<FlatArray> ndarray = 0,
|
||
|
int32_t device = 0,
|
||
|
VarType variabletype = VarType_VARIABLE) {
|
||
|
return nd4j::graph::CreateFlatVariable(
|
||
|
_fbb,
|
||
|
id,
|
||
|
name ? _fbb.CreateString(name) : 0,
|
||
|
dtype,
|
||
|
shape ? _fbb.CreateVector<int64_t>(*shape) : 0,
|
||
|
ndarray,
|
||
|
device,
|
||
|
variabletype);
|
||
|
}
|
||
|
|
||
|
inline const nd4j::graph::FlatVariable *GetFlatVariable(const void *buf) {
|
||
|
return flatbuffers::GetRoot<nd4j::graph::FlatVariable>(buf);
|
||
|
}
|
||
|
|
||
|
inline const nd4j::graph::FlatVariable *GetSizePrefixedFlatVariable(const void *buf) {
|
||
|
return flatbuffers::GetSizePrefixedRoot<nd4j::graph::FlatVariable>(buf);
|
||
|
}
|
||
|
|
||
|
inline bool VerifyFlatVariableBuffer(
|
||
|
flatbuffers::Verifier &verifier) {
|
||
|
return verifier.VerifyBuffer<nd4j::graph::FlatVariable>(nullptr);
|
||
|
}
|
||
|
|
||
|
inline bool VerifySizePrefixedFlatVariableBuffer(
|
||
|
flatbuffers::Verifier &verifier) {
|
||
|
return verifier.VerifySizePrefixedBuffer<nd4j::graph::FlatVariable>(nullptr);
|
||
|
}
|
||
|
|
||
|
inline void FinishFlatVariableBuffer(
|
||
|
flatbuffers::FlatBufferBuilder &fbb,
|
||
|
flatbuffers::Offset<nd4j::graph::FlatVariable> root) {
|
||
|
fbb.Finish(root);
|
||
|
}
|
||
|
|
||
|
inline void FinishSizePrefixedFlatVariableBuffer(
|
||
|
flatbuffers::FlatBufferBuilder &fbb,
|
||
|
flatbuffers::Offset<nd4j::graph::FlatVariable> root) {
|
||
|
fbb.FinishSizePrefixed(root);
|
||
|
}
|
||
|
|
||
|
} // namespace graph
|
||
|
} // namespace nd4j
|
||
|
|
||
|
#endif // FLATBUFFERS_GENERATED_VARIABLE_ND4J_GRAPH_H_
|