aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTai Ly <tai.ly@arm.com>2024-02-14 19:57:38 +0000
committerTai Ly <tai.ly@arm.com>2024-02-22 16:23:03 +0000
commit81db8ee8f580d30ec0ca53067df32ef046e6f09e (patch)
tree138f423e8e7d2c84c699955b150a81b45ada90c1
parent61a8313f5a0cbcfc7c8ee8a44f05a5ca9b1015b9 (diff)
downloadserialization_lib-81db8ee8f580d30ec0ca53067df32ef046e6f09e.tar.gz
[serialization_lib] Align to Tosa Spec
removed attributes for Reshape, Slice and Tile Ops renamed field accum_dtype to acc_type, renamed then_branch/else_branch to then_graph/else_graph renamed cond_branch/body_branch to cond_graph/body_graph Signed-off-by: Tai Ly <tai.ly@arm.com> Change-Id: I2001f19519987d9e64c18b1f11762f9d3b9be4ec
-rw-r--r--include/attribute.def20
-rw-r--r--include/tosa_generated.h380
-rw-r--r--include/tosa_serialization_handler.h4
-rw-r--r--python/serializer/tosa_serializer.py41
-rw-r--r--python/tosa/Attribute.py33
-rw-r--r--python/tosa/CondIfAttribute.py20
-rw-r--r--python/tosa/PoolAttribute.py10
-rw-r--r--python/tosa/ReshapeAttribute.py80
-rw-r--r--python/tosa/SliceAttribute.py119
-rw-r--r--python/tosa/TileAttribute.py80
-rw-r--r--python/tosa/WhileLoopAttribute.py20
-rw-r--r--schema/tosa.fbs26
12 files changed, 135 insertions, 698 deletions
diff --git a/include/attribute.def b/include/attribute.def
index 8d74ff9..b6ff3c2 100644
--- a/include/attribute.def
+++ b/include/attribute.def
@@ -32,7 +32,7 @@ DEF_ATTRIBUTE(Pool, 6,
int32_t, V, stride,
int32_t, S, input_zp,
int32_t, S, output_zp,
- DType, S, accum_dtype)
+ DType, S, acc_type)
DEF_ATTRIBUTE(Conv, 6,
int32_t, V, pad,
@@ -58,16 +58,6 @@ DEF_ATTRIBUTE(Pad, 3,
DEF_ATTRIBUTE(Axis, 1,
int32_t, S, axis)
-DEF_ATTRIBUTE(Reshape, 1,
- int32_t, V, new_shape)
-
-DEF_ATTRIBUTE(Slice, 2,
- int32_t, V, start,
- int32_t, V, size)
-
-DEF_ATTRIBUTE(Tile, 1,
- int32_t, V, multiples)
-
DEF_ATTRIBUTE(Resize, 4,
int16_t, V, scale,
int16_t, V, offset,
@@ -98,12 +88,12 @@ DEF_ATTRIBUTE(ArithmeticRightShift, 1,
bool, S, round)
DEF_ATTRIBUTE(CondIf, 2,
- string, S, then_branch,
- string, S, else_branch)
+ string, S, then_graph,
+ string, S, else_graph)
DEF_ATTRIBUTE(WhileLoop, 2,
- string, S, cond_branch,
- string, S, body_branch)
+ string, S, cond_graph,
+ string, S, body_graph)
DEF_ATTRIBUTE(Transpose, 1,
int32_t, V, perms)
diff --git a/include/tosa_generated.h b/include/tosa_generated.h
index d21a17a..c7a280a 100644
--- a/include/tosa_generated.h
+++ b/include/tosa_generated.h
@@ -30,15 +30,6 @@ struct PadAttributeBuilder;
struct AxisAttribute;
struct AxisAttributeBuilder;
-struct ReshapeAttribute;
-struct ReshapeAttributeBuilder;
-
-struct SliceAttribute;
-struct SliceAttributeBuilder;
-
-struct TileAttribute;
-struct TileAttributeBuilder;
-
struct ResizeAttribute;
struct ResizeAttributeBuilder;
@@ -478,29 +469,26 @@ enum Attribute : uint8_t {
Attribute_TransposeConvAttribute = 3,
Attribute_PadAttribute = 4,
Attribute_AxisAttribute = 5,
- Attribute_ReshapeAttribute = 6,
- Attribute_SliceAttribute = 7,
- Attribute_TileAttribute = 8,
- Attribute_ResizeAttribute = 9,
- Attribute_ClampAttribute = 10,
- Attribute_RescaleAttribute = 11,
- Attribute_MulAttribute = 12,
- Attribute_ArithmeticRightShiftAttribute = 13,
- Attribute_CondIfAttribute = 14,
- Attribute_WhileLoopAttribute = 15,
- Attribute_TransposeAttribute = 16,
- Attribute_TableAttribute = 17,
- Attribute_MatMulAttribute = 18,
- Attribute_FullyConnectedAttribute = 19,
- Attribute_NegateAttribute = 20,
- Attribute_CustomAttribute = 21,
- Attribute_FFTAttribute = 22,
- Attribute_RFFTAttribute = 23,
+ Attribute_ResizeAttribute = 6,
+ Attribute_ClampAttribute = 7,
+ Attribute_RescaleAttribute = 8,
+ Attribute_MulAttribute = 9,
+ Attribute_ArithmeticRightShiftAttribute = 10,
+ Attribute_CondIfAttribute = 11,
+ Attribute_WhileLoopAttribute = 12,
+ Attribute_TransposeAttribute = 13,
+ Attribute_TableAttribute = 14,
+ Attribute_MatMulAttribute = 15,
+ Attribute_FullyConnectedAttribute = 16,
+ Attribute_NegateAttribute = 17,
+ Attribute_CustomAttribute = 18,
+ Attribute_FFTAttribute = 19,
+ Attribute_RFFTAttribute = 20,
Attribute_MIN = Attribute_NONE,
Attribute_MAX = Attribute_RFFTAttribute
};
-inline const Attribute (&EnumValuesAttribute())[24] {
+inline const Attribute (&EnumValuesAttribute())[21] {
static const Attribute values[] = {
Attribute_NONE,
Attribute_PoolAttribute,
@@ -508,9 +496,6 @@ inline const Attribute (&EnumValuesAttribute())[24] {
Attribute_TransposeConvAttribute,
Attribute_PadAttribute,
Attribute_AxisAttribute,
- Attribute_ReshapeAttribute,
- Attribute_SliceAttribute,
- Attribute_TileAttribute,
Attribute_ResizeAttribute,
Attribute_ClampAttribute,
Attribute_RescaleAttribute,
@@ -531,16 +516,13 @@ inline const Attribute (&EnumValuesAttribute())[24] {
}
inline const char * const *EnumNamesAttribute() {
- static const char * const names[25] = {
+ static const char * const names[22] = {
"NONE",
"PoolAttribute",
"ConvAttribute",
"TransposeConvAttribute",
"PadAttribute",
"AxisAttribute",
- "ReshapeAttribute",
- "SliceAttribute",
- "TileAttribute",
"ResizeAttribute",
"ClampAttribute",
"RescaleAttribute",
@@ -591,18 +573,6 @@ template<> struct AttributeTraits<tosa::AxisAttribute> {
static const Attribute enum_value = Attribute_AxisAttribute;
};
-template<> struct AttributeTraits<tosa::ReshapeAttribute> {
- static const Attribute enum_value = Attribute_ReshapeAttribute;
-};
-
-template<> struct AttributeTraits<tosa::SliceAttribute> {
- static const Attribute enum_value = Attribute_SliceAttribute;
-};
-
-template<> struct AttributeTraits<tosa::TileAttribute> {
- static const Attribute enum_value = Attribute_TileAttribute;
-};
-
template<> struct AttributeTraits<tosa::ResizeAttribute> {
static const Attribute enum_value = Attribute_ResizeAttribute;
};
@@ -674,7 +644,7 @@ struct PoolAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
VT_STRIDE = 8,
VT_INPUT_ZP = 10,
VT_OUTPUT_ZP = 12,
- VT_ACCUM_DTYPE = 14
+ VT_ACC_TYPE = 14
};
const ::flatbuffers::Vector<int32_t> *pad() const {
return GetPointer<const ::flatbuffers::Vector<int32_t> *>(VT_PAD);
@@ -691,8 +661,8 @@ struct PoolAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
int32_t output_zp() const {
return GetField<int32_t>(VT_OUTPUT_ZP, 0);
}
- tosa::DType accum_dtype() const {
- return static_cast<tosa::DType>(GetField<uint32_t>(VT_ACCUM_DTYPE, 0));
+ tosa::DType acc_type() const {
+ return static_cast<tosa::DType>(GetField<uint32_t>(VT_ACC_TYPE, 0));
}
bool Verify(::flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
@@ -704,7 +674,7 @@ struct PoolAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
verifier.VerifyVector(stride()) &&
VerifyField<int32_t>(verifier, VT_INPUT_ZP, 4) &&
VerifyField<int32_t>(verifier, VT_OUTPUT_ZP, 4) &&
- VerifyField<uint32_t>(verifier, VT_ACCUM_DTYPE, 4) &&
+ VerifyField<uint32_t>(verifier, VT_ACC_TYPE, 4) &&
verifier.EndTable();
}
};
@@ -728,8 +698,8 @@ struct PoolAttributeBuilder {
void add_output_zp(int32_t output_zp) {
fbb_.AddElement<int32_t>(PoolAttribute::VT_OUTPUT_ZP, output_zp, 0);
}
- void add_accum_dtype(tosa::DType accum_dtype) {
- fbb_.AddElement<uint32_t>(PoolAttribute::VT_ACCUM_DTYPE, static_cast<uint32_t>(accum_dtype), 0);
+ void add_acc_type(tosa::DType acc_type) {
+ fbb_.AddElement<uint32_t>(PoolAttribute::VT_ACC_TYPE, static_cast<uint32_t>(acc_type), 0);
}
explicit PoolAttributeBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
@@ -749,9 +719,9 @@ inline ::flatbuffers::Offset<PoolAttribute> CreatePoolAttribute(
::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> stride = 0,
int32_t input_zp = 0,
int32_t output_zp = 0,
- tosa::DType accum_dtype = tosa::DType_UNKNOWN) {
+ tosa::DType acc_type = tosa::DType_UNKNOWN) {
PoolAttributeBuilder builder_(_fbb);
- builder_.add_accum_dtype(accum_dtype);
+ builder_.add_acc_type(acc_type);
builder_.add_output_zp(output_zp);
builder_.add_input_zp(input_zp);
builder_.add_stride(stride);
@@ -767,7 +737,7 @@ inline ::flatbuffers::Offset<PoolAttribute> CreatePoolAttributeDirect(
const std::vector<int32_t> *stride = nullptr,
int32_t input_zp = 0,
int32_t output_zp = 0,
- tosa::DType accum_dtype = tosa::DType_UNKNOWN) {
+ tosa::DType acc_type = tosa::DType_UNKNOWN) {
auto pad__ = pad ? _fbb.CreateVector<int32_t>(*pad) : 0;
auto kernel__ = kernel ? _fbb.CreateVector<int32_t>(*kernel) : 0;
auto stride__ = stride ? _fbb.CreateVector<int32_t>(*stride) : 0;
@@ -778,7 +748,7 @@ inline ::flatbuffers::Offset<PoolAttribute> CreatePoolAttributeDirect(
stride__,
input_zp,
output_zp,
- accum_dtype);
+ acc_type);
}
struct ConvAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
@@ -1130,173 +1100,6 @@ inline ::flatbuffers::Offset<AxisAttribute> CreateAxisAttribute(
return builder_.Finish();
}
-struct ReshapeAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
- typedef ReshapeAttributeBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
- VT_NEW_SHAPE = 4
- };
- const ::flatbuffers::Vector<int32_t> *new_shape() const {
- return GetPointer<const ::flatbuffers::Vector<int32_t> *>(VT_NEW_SHAPE);
- }
- bool Verify(::flatbuffers::Verifier &verifier) const {
- return VerifyTableStart(verifier) &&
- VerifyOffset(verifier, VT_NEW_SHAPE) &&
- verifier.VerifyVector(new_shape()) &&
- verifier.EndTable();
- }
-};
-
-struct ReshapeAttributeBuilder {
- typedef ReshapeAttribute Table;
- ::flatbuffers::FlatBufferBuilder &fbb_;
- ::flatbuffers::uoffset_t start_;
- void add_new_shape(::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> new_shape) {
- fbb_.AddOffset(ReshapeAttribute::VT_NEW_SHAPE, new_shape);
- }
- explicit ReshapeAttributeBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
- : fbb_(_fbb) {
- start_ = fbb_.StartTable();
- }
- ::flatbuffers::Offset<ReshapeAttribute> Finish() {
- const auto end = fbb_.EndTable(start_);
- auto o = ::flatbuffers::Offset<ReshapeAttribute>(end);
- return o;
- }
-};
-
-inline ::flatbuffers::Offset<ReshapeAttribute> CreateReshapeAttribute(
- ::flatbuffers::FlatBufferBuilder &_fbb,
- ::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> new_shape = 0) {
- ReshapeAttributeBuilder builder_(_fbb);
- builder_.add_new_shape(new_shape);
- return builder_.Finish();
-}
-
-inline ::flatbuffers::Offset<ReshapeAttribute> CreateReshapeAttributeDirect(
- ::flatbuffers::FlatBufferBuilder &_fbb,
- const std::vector<int32_t> *new_shape = nullptr) {
- auto new_shape__ = new_shape ? _fbb.CreateVector<int32_t>(*new_shape) : 0;
- return tosa::CreateReshapeAttribute(
- _fbb,
- new_shape__);
-}
-
-struct SliceAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
- typedef SliceAttributeBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
- VT_START = 4,
- VT_SIZE = 6
- };
- const ::flatbuffers::Vector<int32_t> *start() const {
- return GetPointer<const ::flatbuffers::Vector<int32_t> *>(VT_START);
- }
- const ::flatbuffers::Vector<int32_t> *size() const {
- return GetPointer<const ::flatbuffers::Vector<int32_t> *>(VT_SIZE);
- }
- bool Verify(::flatbuffers::Verifier &verifier) const {
- return VerifyTableStart(verifier) &&
- VerifyOffset(verifier, VT_START) &&
- verifier.VerifyVector(start()) &&
- VerifyOffset(verifier, VT_SIZE) &&
- verifier.VerifyVector(size()) &&
- verifier.EndTable();
- }
-};
-
-struct SliceAttributeBuilder {
- typedef SliceAttribute Table;
- ::flatbuffers::FlatBufferBuilder &fbb_;
- ::flatbuffers::uoffset_t start_;
- void add_start(::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> start) {
- fbb_.AddOffset(SliceAttribute::VT_START, start);
- }
- void add_size(::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> size) {
- fbb_.AddOffset(SliceAttribute::VT_SIZE, size);
- }
- explicit SliceAttributeBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
- : fbb_(_fbb) {
- start_ = fbb_.StartTable();
- }
- ::flatbuffers::Offset<SliceAttribute> Finish() {
- const auto end = fbb_.EndTable(start_);
- auto o = ::flatbuffers::Offset<SliceAttribute>(end);
- return o;
- }
-};
-
-inline ::flatbuffers::Offset<SliceAttribute> CreateSliceAttribute(
- ::flatbuffers::FlatBufferBuilder &_fbb,
- ::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> start = 0,
- ::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> size = 0) {
- SliceAttributeBuilder builder_(_fbb);
- builder_.add_size(size);
- builder_.add_start(start);
- return builder_.Finish();
-}
-
-inline ::flatbuffers::Offset<SliceAttribute> CreateSliceAttributeDirect(
- ::flatbuffers::FlatBufferBuilder &_fbb,
- const std::vector<int32_t> *start = nullptr,
- const std::vector<int32_t> *size = nullptr) {
- auto start__ = start ? _fbb.CreateVector<int32_t>(*start) : 0;
- auto size__ = size ? _fbb.CreateVector<int32_t>(*size) : 0;
- return tosa::CreateSliceAttribute(
- _fbb,
- start__,
- size__);
-}
-
-struct TileAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
- typedef TileAttributeBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
- VT_MULTIPLES = 4
- };
- const ::flatbuffers::Vector<int32_t> *multiples() const {
- return GetPointer<const ::flatbuffers::Vector<int32_t> *>(VT_MULTIPLES);
- }
- bool Verify(::flatbuffers::Verifier &verifier) const {
- return VerifyTableStart(verifier) &&
- VerifyOffset(verifier, VT_MULTIPLES) &&
- verifier.VerifyVector(multiples()) &&
- verifier.EndTable();
- }
-};
-
-struct TileAttributeBuilder {
- typedef TileAttribute Table;
- ::flatbuffers::FlatBufferBuilder &fbb_;
- ::flatbuffers::uoffset_t start_;
- void add_multiples(::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> multiples) {
- fbb_.AddOffset(TileAttribute::VT_MULTIPLES, multiples);
- }
- explicit TileAttributeBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
- : fbb_(_fbb) {
- start_ = fbb_.StartTable();
- }
- ::flatbuffers::Offset<TileAttribute> Finish() {
- const auto end = fbb_.EndTable(start_);
- auto o = ::flatbuffers::Offset<TileAttribute>(end);
- return o;
- }
-};
-
-inline ::flatbuffers::Offset<TileAttribute> CreateTileAttribute(
- ::flatbuffers::FlatBufferBuilder &_fbb,
- ::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> multiples = 0) {
- TileAttributeBuilder builder_(_fbb);
- builder_.add_multiples(multiples);
- return builder_.Finish();
-}
-
-inline ::flatbuffers::Offset<TileAttribute> CreateTileAttributeDirect(
- ::flatbuffers::FlatBufferBuilder &_fbb,
- const std::vector<int32_t> *multiples = nullptr) {
- auto multiples__ = multiples ? _fbb.CreateVector<int32_t>(*multiples) : 0;
- return tosa::CreateTileAttribute(
- _fbb,
- multiples__);
-}
-
struct ResizeAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
typedef ResizeAttributeBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
@@ -1713,21 +1516,21 @@ inline ::flatbuffers::Offset<ArithmeticRightShiftAttribute> CreateArithmeticRigh
struct CondIfAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
typedef CondIfAttributeBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
- VT_THEN_BRANCH = 4,
- VT_ELSE_BRANCH = 6
+ VT_THEN_GRAPH = 4,
+ VT_ELSE_GRAPH = 6
};
- const ::flatbuffers::String *then_branch() const {
- return GetPointer<const ::flatbuffers::String *>(VT_THEN_BRANCH);
+ const ::flatbuffers::String *then_graph() const {
+ return GetPointer<const ::flatbuffers::String *>(VT_THEN_GRAPH);
}
- const ::flatbuffers::String *else_branch() const {
- return GetPointer<const ::flatbuffers::String *>(VT_ELSE_BRANCH);
+ const ::flatbuffers::String *else_graph() const {
+ return GetPointer<const ::flatbuffers::String *>(VT_ELSE_GRAPH);
}
bool Verify(::flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyOffset(verifier, VT_THEN_BRANCH) &&
- verifier.VerifyString(then_branch()) &&
- VerifyOffset(verifier, VT_ELSE_BRANCH) &&
- verifier.VerifyString(else_branch()) &&
+ VerifyOffset(verifier, VT_THEN_GRAPH) &&
+ verifier.VerifyString(then_graph()) &&
+ VerifyOffset(verifier, VT_ELSE_GRAPH) &&
+ verifier.VerifyString(else_graph()) &&
verifier.EndTable();
}
};
@@ -1736,11 +1539,11 @@ struct CondIfAttributeBuilder {
typedef CondIfAttribute Table;
::flatbuffers::FlatBufferBuilder &fbb_;
::flatbuffers::uoffset_t start_;
- void add_then_branch(::flatbuffers::Offset<::flatbuffers::String> then_branch) {
- fbb_.AddOffset(CondIfAttribute::VT_THEN_BRANCH, then_branch);
+ void add_then_graph(::flatbuffers::Offset<::flatbuffers::String> then_graph) {
+ fbb_.AddOffset(CondIfAttribute::VT_THEN_GRAPH, then_graph);
}
- void add_else_branch(::flatbuffers::Offset<::flatbuffers::String> else_branch) {
- fbb_.AddOffset(CondIfAttribute::VT_ELSE_BRANCH, else_branch);
+ void add_else_graph(::flatbuffers::Offset<::flatbuffers::String> else_graph) {
+ fbb_.AddOffset(CondIfAttribute::VT_ELSE_GRAPH, else_graph);
}
explicit CondIfAttributeBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
@@ -1755,44 +1558,44 @@ struct CondIfAttributeBuilder {
inline ::flatbuffers::Offset<CondIfAttribute> CreateCondIfAttribute(
::flatbuffers::FlatBufferBuilder &_fbb,
- ::flatbuffers::Offset<::flatbuffers::String> then_branch = 0,
- ::flatbuffers::Offset<::flatbuffers::String> else_branch = 0) {
+ ::flatbuffers::Offset<::flatbuffers::String> then_graph = 0,
+ ::flatbuffers::Offset<::flatbuffers::String> else_graph = 0) {
CondIfAttributeBuilder builder_(_fbb);
- builder_.add_else_branch(else_branch);
- builder_.add_then_branch(then_branch);
+ builder_.add_else_graph(else_graph);
+ builder_.add_then_graph(then_graph);
return builder_.Finish();
}
inline ::flatbuffers::Offset<CondIfAttribute> CreateCondIfAttributeDirect(
::flatbuffers::FlatBufferBuilder &_fbb,
- const char *then_branch = nullptr,
- const char *else_branch = nullptr) {
- auto then_branch__ = then_branch ? _fbb.CreateString(then_branch) : 0;
- auto else_branch__ = else_branch ? _fbb.CreateString(else_branch) : 0;
+ const char *then_graph = nullptr,
+ const char *else_graph = nullptr) {
+ auto then_graph__ = then_graph ? _fbb.CreateString(then_graph) : 0;
+ auto else_graph__ = else_graph ? _fbb.CreateString(else_graph) : 0;
return tosa::CreateCondIfAttribute(
_fbb,
- then_branch__,
- else_branch__);
+ then_graph__,
+ else_graph__);
}
struct WhileLoopAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
typedef WhileLoopAttributeBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
- VT_COND_BRANCH = 4,
- VT_BODY_BRANCH = 6
+ VT_COND_GRAPH = 4,
+ VT_BODY_GRAPH = 6
};
- const ::flatbuffers::String *cond_branch() const {
- return GetPointer<const ::flatbuffers::String *>(VT_COND_BRANCH);
+ const ::flatbuffers::String *cond_graph() const {
+ return GetPointer<const ::flatbuffers::String *>(VT_COND_GRAPH);
}
- const ::flatbuffers::String *body_branch() const {
- return GetPointer<const ::flatbuffers::String *>(VT_BODY_BRANCH);
+ const ::flatbuffers::String *body_graph() const {
+ return GetPointer<const ::flatbuffers::String *>(VT_BODY_GRAPH);
}
bool Verify(::flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyOffset(verifier, VT_COND_BRANCH) &&
- verifier.VerifyString(cond_branch()) &&
- VerifyOffset(verifier, VT_BODY_BRANCH) &&
- verifier.VerifyString(body_branch()) &&
+ VerifyOffset(verifier, VT_COND_GRAPH) &&
+ verifier.VerifyString(cond_graph()) &&
+ VerifyOffset(verifier, VT_BODY_GRAPH) &&
+ verifier.VerifyString(body_graph()) &&
verifier.EndTable();
}
};
@@ -1801,11 +1604,11 @@ struct WhileLoopAttributeBuilder {
typedef WhileLoopAttribute Table;
::flatbuffers::FlatBufferBuilder &fbb_;
::flatbuffers::uoffset_t start_;
- void add_cond_branch(::flatbuffers::Offset<::flatbuffers::String> cond_branch) {
- fbb_.AddOffset(WhileLoopAttribute::VT_COND_BRANCH, cond_branch);
+ void add_cond_graph(::flatbuffers::Offset<::flatbuffers::String> cond_graph) {
+ fbb_.AddOffset(WhileLoopAttribute::VT_COND_GRAPH, cond_graph);
}
- void add_body_branch(::flatbuffers::Offset<::flatbuffers::String> body_branch) {
- fbb_.AddOffset(WhileLoopAttribute::VT_BODY_BRANCH, body_branch);
+ void add_body_graph(::flatbuffers::Offset<::flatbuffers::String> body_graph) {
+ fbb_.AddOffset(WhileLoopAttribute::VT_BODY_GRAPH, body_graph);
}
explicit WhileLoopAttributeBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
@@ -1820,24 +1623,24 @@ struct WhileLoopAttributeBuilder {
inline ::flatbuffers::Offset<WhileLoopAttribute> CreateWhileLoopAttribute(
::flatbuffers::FlatBufferBuilder &_fbb,
- ::flatbuffers::Offset<::flatbuffers::String> cond_branch = 0,
- ::flatbuffers::Offset<::flatbuffers::String> body_branch = 0) {
+ ::flatbuffers::Offset<::flatbuffers::String> cond_graph = 0,
+ ::flatbuffers::Offset<::flatbuffers::String> body_graph = 0) {
WhileLoopAttributeBuilder builder_(_fbb);
- builder_.add_body_branch(body_branch);
- builder_.add_cond_branch(cond_branch);
+ builder_.add_body_graph(body_graph);
+ builder_.add_cond_graph(cond_graph);
return builder_.Finish();
}
inline ::flatbuffers::Offset<WhileLoopAttribute> CreateWhileLoopAttributeDirect(
::flatbuffers::FlatBufferBuilder &_fbb,
- const char *cond_branch = nullptr,
- const char *body_branch = nullptr) {
- auto cond_branch__ = cond_branch ? _fbb.CreateString(cond_branch) : 0;
- auto body_branch__ = body_branch ? _fbb.CreateString(body_branch) : 0;
+ const char *cond_graph = nullptr,
+ const char *body_graph = nullptr) {
+ auto cond_graph__ = cond_graph ? _fbb.CreateString(cond_graph) : 0;
+ auto body_graph__ = body_graph ? _fbb.CreateString(body_graph) : 0;
return tosa::CreateWhileLoopAttribute(
_fbb,
- cond_branch__,
- body_branch__);
+ cond_graph__,
+ body_graph__);
}
struct TransposeAttribute FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
@@ -2501,15 +2304,6 @@ struct TosaOperator FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
const tosa::AxisAttribute *attribute_as_AxisAttribute() const {
return attribute_type() == tosa::Attribute_AxisAttribute ? static_cast<const tosa::AxisAttribute *>(attribute()) : nullptr;
}
- const tosa::ReshapeAttribute *attribute_as_ReshapeAttribute() const {
- return attribute_type() == tosa::Attribute_ReshapeAttribute ? static_cast<const tosa::ReshapeAttribute *>(attribute()) : nullptr;
- }
- const tosa::SliceAttribute *attribute_as_SliceAttribute() const {
- return attribute_type() == tosa::Attribute_SliceAttribute ? static_cast<const tosa::SliceAttribute *>(attribute()) : nullptr;
- }
- const tosa::TileAttribute *attribute_as_TileAttribute() const {
- return attribute_type() == tosa::Attribute_TileAttribute ? static_cast<const tosa::TileAttribute *>(attribute()) : nullptr;
- }
const tosa::ResizeAttribute *attribute_as_ResizeAttribute() const {
return attribute_type() == tosa::Attribute_ResizeAttribute ? static_cast<const tosa::ResizeAttribute *>(attribute()) : nullptr;
}
@@ -2597,18 +2391,6 @@ template<> inline const tosa::AxisAttribute *TosaOperator::attribute_as<tosa::Ax
return attribute_as_AxisAttribute();
}
-template<> inline const tosa::ReshapeAttribute *TosaOperator::attribute_as<tosa::ReshapeAttribute>() const {
- return attribute_as_ReshapeAttribute();
-}
-
-template<> inline const tosa::SliceAttribute *TosaOperator::attribute_as<tosa::SliceAttribute>() const {
- return attribute_as_SliceAttribute();
-}
-
-template<> inline const tosa::TileAttribute *TosaOperator::attribute_as<tosa::TileAttribute>() const {
- return attribute_as_TileAttribute();
-}
-
template<> inline const tosa::ResizeAttribute *TosaOperator::attribute_as<tosa::ResizeAttribute>() const {
return attribute_as_ResizeAttribute();
}
@@ -3001,18 +2783,6 @@ inline bool VerifyAttribute(::flatbuffers::Verifier &verifier, const void *obj,
auto ptr = reinterpret_cast<const tosa::AxisAttribute *>(obj);
return verifier.VerifyTable(ptr);
}
- case Attribute_ReshapeAttribute: {
- auto ptr = reinterpret_cast<const tosa::ReshapeAttribute *>(obj);
- return verifier.VerifyTable(ptr);
- }
- case Attribute_SliceAttribute: {
- auto ptr = reinterpret_cast<const tosa::SliceAttribute *>(obj);
- return verifier.VerifyTable(ptr);
- }
- case Attribute_TileAttribute: {
- auto ptr = reinterpret_cast<const tosa::TileAttribute *>(obj);
- return verifier.VerifyTable(ptr);
- }
case Attribute_ResizeAttribute: {
auto ptr = reinterpret_cast<const tosa::ResizeAttribute *>(obj);
return verifier.VerifyTable(ptr);
diff --git a/include/tosa_serialization_handler.h b/include/tosa_serialization_handler.h
index 715270b..f50d7ad 100644
--- a/include/tosa_serialization_handler.h
+++ b/include/tosa_serialization_handler.h
@@ -127,8 +127,8 @@ struct TosaVersion
if (major_match && minor_match && patch_match && draft_match)
return TosaVersion::compat_t::COMPLETELY_COMPATIBLE;
- // We currently support backward compatibility starting from 0.90.0
- if ((tosa_fb_version._major == 0 && tosa_fb_version._minor >= 90) || (tosa_fb_version._major > 0))
+ // We currently support backward compatibility starting from 0.100.0
+ if ((tosa_fb_version._major == 0 && tosa_fb_version._minor >= 100) || (tosa_fb_version._major > 0))
{
if (less_than(tosa_fb_version, serializer_version))
{
diff --git a/python/serializer/tosa_serializer.py b/python/serializer/tosa_serializer.py
index 1aadbff..546de7d 100644
--- a/python/serializer/tosa_serializer.py
+++ b/python/serializer/tosa_serializer.py
@@ -159,7 +159,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
pad,
input_zp,
output_zp,
- accum_dtype,
+ acc_type,
):
from tosa import PoolAttribute as a, Attribute
@@ -171,7 +171,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
self.intvecs.append((a.AddStride, stride))
self.ints.append((a.AddInputZp, input_zp))
self.ints.append((a.AddOutputZp, output_zp))
- self.ints.append((a.AddAccumDtype, accum_dtype))
+ self.ints.append((a.AddAccType, acc_type))
def ConvAttribute(self, pad, stride, dilation, input_zp, weight_zp, local_bound):
from tosa import ConvAttribute as a, Attribute
@@ -226,31 +226,6 @@ class TosaSerializerAttribute(TosaSerializerUnion):
self.ints.append((a.AddAxis, axis))
- def ReshapeAttribute(self, new_shape):
- from tosa import ReshapeAttribute as a, Attribute
-
- self.utype = Attribute.Attribute().ReshapeAttribute
- self.optFcns = (a.Start, a.End)
-
- self.intvecs.append((a.AddNewShape, new_shape))
-
- def SliceAttribute(self, start, size):
- from tosa import SliceAttribute as a, Attribute
-
- self.utype = Attribute.Attribute().SliceAttribute
- self.optFcns = (a.Start, a.End)
-
- self.intvecs.append((a.AddStart, start))
- self.intvecs.append((a.AddSize, size))
-
- def TileAttribute(self, multiples):
- from tosa import TileAttribute as a, Attribute
-
- self.utype = Attribute.Attribute().TileAttribute
- self.optFcns = (a.Start, a.End)
-
- self.intvecs.append((a.AddMultiples, multiples))
-
def ResizeAttribute(self, scale, offset, border, mode):
from tosa import ResizeAttribute as a, Attribute
@@ -330,23 +305,23 @@ class TosaSerializerAttribute(TosaSerializerUnion):
self.bools.append((a.AddRound, round))
- def CondIfAttribute(self, then_branch, else_branch):
+ def CondIfAttribute(self, then_graph, else_graph):
from tosa import CondIfAttribute as a, Attribute
self.utype = Attribute.Attribute().CondIfAttribute
self.optFcns = (a.Start, a.End)
- self.strings.append((a.AddThenBranch, then_branch))
- self.strings.append((a.AddElseBranch, else_branch))
+ self.strings.append((a.AddThenGraph, then_graph))
+ self.strings.append((a.AddElseGraph, else_graph))
- def WhileLoopAttribute(self, cond_branch, body_branch):
+ def WhileLoopAttribute(self, cond_graph, body_graph):
from tosa import WhileLoopAttribute as a, Attribute
self.utype = Attribute.Attribute().WhileLoopAttribute
self.optFcns = (a.Start, a.End)
- self.strings.append((a.AddCondBranch, cond_branch))
- self.strings.append((a.AddBodyBranch, body_branch))
+ self.strings.append((a.AddCondGraph, cond_graph))
+ self.strings.append((a.AddBodyGraph, body_graph))
def TransposeAttribute(self, perms):
from tosa import TransposeAttribute as a, Attribute
diff --git a/python/tosa/Attribute.py b/python/tosa/Attribute.py
index 2589f71..6abdcfb 100644
--- a/python/tosa/Attribute.py
+++ b/python/tosa/Attribute.py
@@ -9,21 +9,18 @@ class Attribute(object):
TransposeConvAttribute = 3
PadAttribute = 4
AxisAttribute = 5
- ReshapeAttribute = 6
- SliceAttribute = 7
- TileAttribute = 8
- ResizeAttribute = 9
- ClampAttribute = 10
- RescaleAttribute = 11
- MulAttribute = 12
- ArithmeticRightShiftAttribute = 13
- CondIfAttribute = 14
- WhileLoopAttribute = 15
- TransposeAttribute = 16
- TableAttribute = 17
- MatMulAttribute = 18
- FullyConnectedAttribute = 19
- NegateAttribute = 20
- CustomAttribute = 21
- FFTAttribute = 22
- RFFTAttribute = 23
+ ResizeAttribute = 6
+ ClampAttribute = 7
+ RescaleAttribute = 8
+ MulAttribute = 9
+ ArithmeticRightShiftAttribute = 10
+ CondIfAttribute = 11
+ WhileLoopAttribute = 12
+ TransposeAttribute = 13
+ TableAttribute = 14
+ MatMulAttribute = 15
+ FullyConnectedAttribute = 16
+ NegateAttribute = 17
+ CustomAttribute = 18
+ FFTAttribute = 19
+ RFFTAttribute = 20
diff --git a/python/tosa/CondIfAttribute.py b/python/tosa/CondIfAttribute.py
index cdecec6..8f2aa9b 100644
--- a/python/tosa/CondIfAttribute.py
+++ b/python/tosa/CondIfAttribute.py
@@ -29,14 +29,14 @@ class CondIfAttribute(object):
self._tab = flatbuffers.table.Table(buf, pos)
# CondIfAttribute
- def ThenBranch(self):
+ def ThenGraph(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.String(o + self._tab.Pos)
return None
# CondIfAttribute
- def ElseBranch(self):
+ def ElseGraph(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.String(o + self._tab.Pos)
@@ -48,17 +48,17 @@ def CondIfAttributeStart(builder):
def Start(builder):
CondIfAttributeStart(builder)
-def CondIfAttributeAddThenBranch(builder, thenBranch):
- builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(thenBranch), 0)
+def CondIfAttributeAddThenGraph(builder, thenGraph):
+ builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(thenGraph), 0)
-def AddThenBranch(builder, thenBranch):
- CondIfAttributeAddThenBranch(builder, thenBranch)
+def AddThenGraph(builder, thenGraph):
+ CondIfAttributeAddThenGraph(builder, thenGraph)
-def CondIfAttributeAddElseBranch(builder, elseBranch):
- builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(elseBranch), 0)
+def CondIfAttributeAddElseGraph(builder, elseGraph):
+ builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(elseGraph), 0)
-def AddElseBranch(builder, elseBranch):
- CondIfAttributeAddElseBranch(builder, elseBranch)
+def AddElseGraph(builder, elseGraph):
+ CondIfAttributeAddElseGraph(builder, elseGraph)
def CondIfAttributeEnd(builder):
return builder.EndObject()
diff --git a/python/tosa/PoolAttribute.py b/python/tosa/PoolAttribute.py
index ea31544..c13e038 100644
--- a/python/tosa/PoolAttribute.py
+++ b/python/tosa/PoolAttribute.py
@@ -124,7 +124,7 @@ class PoolAttribute(object):
return 0
# PoolAttribute
- def AccumDtype(self):
+ def AccType(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
@@ -184,11 +184,11 @@ def PoolAttributeAddOutputZp(builder, outputZp):
def AddOutputZp(builder, outputZp):
PoolAttributeAddOutputZp(builder, outputZp)
-def PoolAttributeAddAccumDtype(builder, accumDtype):
- builder.PrependUint32Slot(5, accumDtype, 0)
+def PoolAttributeAddAccType(builder, accType):
+ builder.PrependUint32Slot(5, accType, 0)
-def AddAccumDtype(builder, accumDtype):
- PoolAttributeAddAccumDtype(builder, accumDtype)
+def AddAccType(builder, accType):
+ PoolAttributeAddAccType(builder, accType)
def PoolAttributeEnd(builder):
return builder.EndObject()
diff --git a/python/tosa/ReshapeAttribute.py b/python/tosa/ReshapeAttribute.py
deleted file mode 100644
index 7df6546..0000000
--- a/python/tosa/ReshapeAttribute.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# automatically generated by the FlatBuffers compiler, do not modify
-
-# namespace: tosa
-
-import flatbuffers
-from flatbuffers.compat import import_numpy
-np = import_numpy()
-
-class ReshapeAttribute(object):
- __slots__ = ['_tab']
-
- @classmethod
- def GetRootAs(cls, buf, offset=0):
- n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
- x = ReshapeAttribute()
- x.Init(buf, n + offset)
- return x
-
- @classmethod
- def GetRootAsReshapeAttribute(cls, buf, offset=0):
- """This method is deprecated. Please switch to GetRootAs."""
- return cls.GetRootAs(buf, offset)
- @classmethod
- def ReshapeAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
- return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
-
- # ReshapeAttribute
- def Init(self, buf, pos):
- self._tab = flatbuffers.table.Table(buf, pos)
-
- # ReshapeAttribute
- def NewShape(self, j):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- if o != 0:
- a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
- return 0
-
- # ReshapeAttribute
- def NewShapeAsNumpy(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- if o != 0:
- return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
- return 0
-
- # ReshapeAttribute
- def NewShapeLength(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- if o != 0:
- return self._tab.VectorLen(o)
- return 0
-
- # ReshapeAttribute
- def NewShapeIsNone(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- return o == 0
-
-def ReshapeAttributeStart(builder):
- builder.StartObject(1)
-
-def Start(builder):
- ReshapeAttributeStart(builder)
-
-def ReshapeAttributeAddNewShape(builder, newShape):
- builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(newShape), 0)
-
-def AddNewShape(builder, newShape):
- ReshapeAttributeAddNewShape(builder, newShape)
-
-def ReshapeAttributeStartNewShapeVector(builder, numElems):
- return builder.StartVector(4, numElems, 4)
-
-def StartNewShapeVector(builder, numElems: int) -> int:
- return ReshapeAttributeStartNewShapeVector(builder, numElems)
-
-def ReshapeAttributeEnd(builder):
- return builder.EndObject()
-
-def End(builder):
- return ReshapeAttributeEnd(builder)
diff --git a/python/tosa/SliceAttribute.py b/python/tosa/SliceAttribute.py
deleted file mode 100644
index 6d8e00b..0000000
--- a/python/tosa/SliceAttribute.py
+++ /dev/null
@@ -1,119 +0,0 @@
-# automatically generated by the FlatBuffers compiler, do not modify
-
-# namespace: tosa
-
-import flatbuffers
-from flatbuffers.compat import import_numpy
-np = import_numpy()
-
-class SliceAttribute(object):
- __slots__ = ['_tab']
-
- @classmethod
- def GetRootAs(cls, buf, offset=0):
- n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
- x = SliceAttribute()
- x.Init(buf, n + offset)
- return x
-
- @classmethod
- def GetRootAsSliceAttribute(cls, buf, offset=0):
- """This method is deprecated. Please switch to GetRootAs."""
- return cls.GetRootAs(buf, offset)
- @classmethod
- def SliceAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
- return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
-
- # SliceAttribute
- def Init(self, buf, pos):
- self._tab = flatbuffers.table.Table(buf, pos)
-
- # SliceAttribute
- def Start(self, j):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- if o != 0:
- a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
- return 0
-
- # SliceAttribute
- def StartAsNumpy(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- if o != 0:
- return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
- return 0
-
- # SliceAttribute
- def StartLength(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- if o != 0:
- return self._tab.VectorLen(o)
- return 0
-
- # SliceAttribute
- def StartIsNone(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- return o == 0
-
- # SliceAttribute
- def Size(self, j):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
- if o != 0:
- a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
- return 0
-
- # SliceAttribute
- def SizeAsNumpy(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
- if o != 0:
- return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
- return 0
-
- # SliceAttribute
- def SizeLength(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
- if o != 0:
- return self._tab.VectorLen(o)
- return 0
-
- # SliceAttribute
- def SizeIsNone(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
- return o == 0
-
-def SliceAttributeStart(builder):
- builder.StartObject(2)
-
-def Start(builder):
- SliceAttributeStart(builder)
-
-def SliceAttributeAddStart(builder, start):
- builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(start), 0)
-
-def AddStart(builder, start):
- SliceAttributeAddStart(builder, start)
-
-def SliceAttributeStartStartVector(builder, numElems):
- return builder.StartVector(4, numElems, 4)
-
-def StartStartVector(builder, numElems: int) -> int:
- return SliceAttributeStartStartVector(builder, numElems)
-
-def SliceAttributeAddSize(builder, size):
- builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(size), 0)
-
-def AddSize(builder, size):
- SliceAttributeAddSize(builder, size)
-
-def SliceAttributeStartSizeVector(builder, numElems):
- return builder.StartVector(4, numElems, 4)
-
-def StartSizeVector(builder, numElems: int) -> int:
- return SliceAttributeStartSizeVector(builder, numElems)
-
-def SliceAttributeEnd(builder):
- return builder.EndObject()
-
-def End(builder):
- return SliceAttributeEnd(builder)
diff --git a/python/tosa/TileAttribute.py b/python/tosa/TileAttribute.py
deleted file mode 100644
index 89bf23b..0000000
--- a/python/tosa/TileAttribute.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# automatically generated by the FlatBuffers compiler, do not modify
-
-# namespace: tosa
-
-import flatbuffers
-from flatbuffers.compat import import_numpy
-np = import_numpy()
-
-class TileAttribute(object):
- __slots__ = ['_tab']
-
- @classmethod
- def GetRootAs(cls, buf, offset=0):
- n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
- x = TileAttribute()
- x.Init(buf, n + offset)
- return x
-
- @classmethod
- def GetRootAsTileAttribute(cls, buf, offset=0):
- """This method is deprecated. Please switch to GetRootAs."""
- return cls.GetRootAs(buf, offset)
- @classmethod
- def TileAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
- return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
-
- # TileAttribute
- def Init(self, buf, pos):
- self._tab = flatbuffers.table.Table(buf, pos)
-
- # TileAttribute
- def Multiples(self, j):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- if o != 0:
- a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
- return 0
-
- # TileAttribute
- def MultiplesAsNumpy(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- if o != 0:
- return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
- return 0
-
- # TileAttribute
- def MultiplesLength(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- if o != 0:
- return self._tab.VectorLen(o)
- return 0
-
- # TileAttribute
- def MultiplesIsNone(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
- return o == 0
-
-def TileAttributeStart(builder):
- builder.StartObject(1)
-
-def Start(builder):
- TileAttributeStart(builder)
-
-def TileAttributeAddMultiples(builder, multiples):
- builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(multiples), 0)
-
-def AddMultiples(builder, multiples):
- TileAttributeAddMultiples(builder, multiples)
-
-def TileAttributeStartMultiplesVector(builder, numElems):
- return builder.StartVector(4, numElems, 4)
-
-def StartMultiplesVector(builder, numElems: int) -> int:
- return TileAttributeStartMultiplesVector(builder, numElems)
-
-def TileAttributeEnd(builder):
- return builder.EndObject()
-
-def End(builder):
- return TileAttributeEnd(builder)
diff --git a/python/tosa/WhileLoopAttribute.py b/python/tosa/WhileLoopAttribute.py
index 20bc728..5148c26 100644
--- a/python/tosa/WhileLoopAttribute.py
+++ b/python/tosa/WhileLoopAttribute.py
@@ -29,14 +29,14 @@ class WhileLoopAttribute(object):
self._tab = flatbuffers.table.Table(buf, pos)
# WhileLoopAttribute
- def CondBranch(self):
+ def CondGraph(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.String(o + self._tab.Pos)
return None
# WhileLoopAttribute
- def BodyBranch(self):
+ def BodyGraph(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.String(o + self._tab.Pos)
@@ -48,17 +48,17 @@ def WhileLoopAttributeStart(builder):
def Start(builder):
WhileLoopAttributeStart(builder)
-def WhileLoopAttributeAddCondBranch(builder, condBranch):
- builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(condBranch), 0)
+def WhileLoopAttributeAddCondGraph(builder, condGraph):
+ builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(condGraph), 0)
-def AddCondBranch(builder, condBranch):
- WhileLoopAttributeAddCondBranch(builder, condBranch)
+def AddCondGraph(builder, condGraph):
+ WhileLoopAttributeAddCondGraph(builder, condGraph)
-def WhileLoopAttributeAddBodyBranch(builder, bodyBranch):
- builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(bodyBranch), 0)
+def WhileLoopAttributeAddBodyGraph(builder, bodyGraph):
+ builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(bodyGraph), 0)
-def AddBodyBranch(builder, bodyBranch):
- WhileLoopAttributeAddBodyBranch(builder, bodyBranch)
+def AddBodyGraph(builder, bodyGraph):
+ WhileLoopAttributeAddBodyGraph(builder, bodyGraph)
def WhileLoopAttributeEnd(builder):
return builder.EndObject()
diff --git a/schema/tosa.fbs b/schema/tosa.fbs
index e37c89a..2bb3470 100644
--- a/schema/tosa.fbs
+++ b/schema/tosa.fbs
@@ -137,9 +137,6 @@ union Attribute {
TransposeConvAttribute,
PadAttribute,
AxisAttribute,
- ReshapeAttribute,
- SliceAttribute,
- TileAttribute,
ResizeAttribute,
ClampAttribute,
RescaleAttribute,
@@ -163,7 +160,7 @@ table PoolAttribute {
stride: [int32];
input_zp: int32;
output_zp: int32;
- accum_dtype: DType;
+ acc_type: DType;
}
table ConvAttribute {
@@ -194,19 +191,6 @@ table AxisAttribute {
axis: int32;
}
-table ReshapeAttribute {
- new_shape: [int32];
-}
-
-table SliceAttribute {
- start: [int32];
- size: [int32];
-}
-
-table TileAttribute {
- multiples: [int32];
-}
-
table ResizeAttribute {
scale: [int16];
offset: [int16];
@@ -242,13 +226,13 @@ table ArithmeticRightShiftAttribute {
}
table CondIfAttribute {
- then_branch: string;
- else_branch: string;
+ then_graph: string;
+ else_graph: string;
}
table WhileLoopAttribute {
- cond_branch: string;
- body_branch: string;
+ cond_graph: string;
+ body_graph: string;
}
table TransposeAttribute {