aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt88
-rw-r--r--include/attribute.def11
-rw-r--r--include/tosa_generated.h216
-rw-r--r--include/tosa_serialization_handler.h2
-rw-r--r--python/serializer/tosa_serializer.py70
-rw-r--r--python/tosa/ArithmeticRightShiftAttribute.py12
-rw-r--r--python/tosa/Attribute.py1
-rw-r--r--python/tosa/AxisAttribute.py12
-rw-r--r--python/tosa/ClampAttribute.py18
-rw-r--r--python/tosa/CondIfAttribute.py14
-rw-r--r--python/tosa/ConvAttribute.py26
-rw-r--r--python/tosa/DType.py1
-rw-r--r--python/tosa/FullyConnectedAttribute.py14
-rw-r--r--python/tosa/MatMulAttribute.py14
-rw-r--r--python/tosa/MulAttribute.py12
-rw-r--r--python/tosa/NegateAttribute.py14
-rw-r--r--python/tosa/Op.py1
-rw-r--r--python/tosa/PadAttribute.py18
-rw-r--r--python/tosa/PoolAttribute.py26
-rw-r--r--python/tosa/RescaleAttribute.py28
-rw-r--r--python/tosa/ReshapeAttribute.py14
-rw-r--r--python/tosa/ResizeAttribute.py144
-rw-r--r--python/tosa/ResizeMode.py1
-rw-r--r--python/tosa/SliceAttribute.py18
-rw-r--r--python/tosa/TableAttribute.py14
-rw-r--r--python/tosa/TileAttribute.py14
-rw-r--r--python/tosa/TosaBasicBlock.py28
-rw-r--r--python/tosa/TosaGraph.py16
-rw-r--r--python/tosa/TosaOperator.py24
-rw-r--r--python/tosa/TosaTensor.py22
-rw-r--r--python/tosa/TransposeAttribute.py14
-rw-r--r--python/tosa/TransposeConvAttribute.py26
-rw-r--r--python/tosa/Version.py22
-rw-r--r--python/tosa/WhileLoopAttribute.py14
-rw-r--r--schema/tosa.fbs11
m---------third_party/flatbuffers0
36 files changed, 651 insertions, 329 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aaba60e..87e0825 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
#TOSA serialization library
-# Copyright (c) 2020-2021, ARM Limited.
+# Copyright (c) 2020-2022, ARM Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -24,42 +24,84 @@ set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_VERBOSE_MAKEFILE ON)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-include_directories(${PROJECT_SOURCE_DIR}/third_party/flatbuffers/include)
+option(BUILD_TESTS "Build test applications" ON)
+option(FLATBUFFERS_ROOT "Location where the flatbuffers 'include' and 'lib' folders to be found" Off)
-# Turn off unnecessary flatbuffers targets
-set(FLATBUFFERS_BUILD_TESTS OFF)
-add_subdirectory(third_party/flatbuffers)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-add_library(tosa_serialization_lib STATIC
+add_library(tosa_serialization_lib
src/tosa_serialization_handler.cpp
src/numpy_utils.cpp
)
-target_link_libraries(tosa_serialization_lib PRIVATE flatbuffers)
-
-add_executable(serialization_read_write
- test/src/serialization_read_write.cpp
+# Verify we have a valid flatbuffers include path.
+# We will explicitly exclude the system include directories and only
+# accept either a user supplied value or the local third_party/flatbuffers.
+find_path(FLATBUFFERS_INCLUDE_PATH flatbuffers/flatbuffers.h
+ NO_DEFAULT_PATH
+ HINTS ${FLATBUFFERS_ROOT} ./third_party/flatbuffers
+ PATH_SUFFIXES include)
+message(STATUS "Flatbuffers include located at: ${FLATBUFFERS_INCLUDE_PATH}")
+include_directories(${FLATBUFFERS_INCLUDE_PATH})
+
+# Next is the library.
+# We will explicitly exclude the system lib directories and only accept
+# either a user supplied value or the local third_party/flatbuffers.
+find_library(FLATBUFFERS_LIBRARY
+ NAMES libflatbuffers.a flatbuffers
+ NO_DEFAULT_PATH
+ HINTS ${FLATBUFFERS_ROOT} ./third_party/flatbuffers
+ PATH_SUFFIXES lib)
+
+if(FLATBUFFERS_LIBRARY)
+ message(STATUS "Flatbuffers library located at: ${FLATBUFFERS_LIBRARY}")
+ target_link_libraries(tosa_serialization_lib PRIVATE ${FLATBUFFERS_LIBRARY})
+else()
+ # It's not there we treat third_party/flatbuffers as a sub project.
+ # In this case we'll need to build the downloaded source.
+ # Turn off unnecessary flatbuffers targets
+ set(FLATBUFFERS_BUILD_TESTS OFF)
+ add_subdirectory(third_party/flatbuffers)
+ target_link_libraries(tosa_serialization_lib PRIVATE flatbuffers)
+endif()
+
+set(public_headers)
+list(APPEND public_headers
+ include/attribute.h
+ include/attribute.def
+ include/numpy_utils.h
+ include/tosa_generated.h
+ include/tosa_serialization_handler.h
)
-target_link_libraries(serialization_read_write
- tosa_serialization_lib
-)
+set_target_properties(tosa_serialization_lib PROPERTIES PUBLIC_HEADER "${public_headers}")
-add_executable(serialization_npy_test
- test/src/serialization_npy_test.cpp
-)
+# Optionally build test executables.
+if (BUILD_TESTS)
+ add_executable(serialization_read_write
+ test/src/serialization_read_write.cpp
+ )
-target_link_libraries(serialization_npy_test
- tosa_serialization_lib
-)
+ target_link_libraries(serialization_read_write
+ tosa_serialization_lib
+ )
-set(TOSA_SERIALIZATION_LIB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/tosa_serialization_lib")
+ add_executable(serialization_npy_test
+ test/src/serialization_npy_test.cpp
+ )
+ target_link_libraries(serialization_npy_test
+ tosa_serialization_lib
+ )
+endif()
+
+set(TOSA_SERIALIZATION_LIB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/tosa_serialization_lib")
+# Follow GNU packaging norms for installation directory structure.
+include(GNUInstallDirs)
install(
TARGETS tosa_serialization_lib EXPORT TosaSerializationLibTargets
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ PUBLIC_HEADER
+ ARCHIVE
)
install(EXPORT TosaSerializationLibTargets
diff --git a/include/attribute.def b/include/attribute.def
index ea91869..b40a77b 100644
--- a/include/attribute.def
+++ b/include/attribute.def
@@ -65,13 +65,10 @@ DEF_ATTRIBUTE(Slice, 2,
DEF_ATTRIBUTE(Tile, 1,
int32_t, V, multiples)
-DEF_ATTRIBUTE(Resize, 7,
- int32_t, V, output_size,
- int32_t, V, stride,
- int32_t, V, offset,
- int32_t, S, shift,
- float, V, stride_fp,
- float, V, offset_fp,
+DEF_ATTRIBUTE(Resize, 4,
+ int16_t, V, scale,
+ int16_t, V, offset,
+ int16_t, V, border,
ResizeMode, S, mode)
DEF_ATTRIBUTE(Clamp, 4,
diff --git a/include/tosa_generated.h b/include/tosa_generated.h
index 023825d..b54a324 100644
--- a/include/tosa_generated.h
+++ b/include/tosa_generated.h
@@ -83,7 +83,7 @@ struct TosaBasicBlockBuilder;
struct TosaGraph;
struct TosaGraphBuilder;
-enum DType {
+enum DType : uint32_t {
DType_UNKNOWN = 0,
DType_BOOL = 1,
DType_UINT8 = 2,
@@ -137,7 +137,7 @@ inline const char *EnumNameDType(DType e) {
return EnumNamesDType()[index];
}
-enum ResizeMode {
+enum ResizeMode : uint32_t {
ResizeMode_UNKNOWN = 0,
ResizeMode_NEAREST = 1,
ResizeMode_BILINEAR = 2,
@@ -170,7 +170,7 @@ inline const char *EnumNameResizeMode(ResizeMode e) {
return EnumNamesResizeMode()[index];
}
-enum Op {
+enum Op : uint32_t {
Op_UNKNOWN = 0,
Op_ARGMAX = 1,
Op_AVG_POOL2D = 2,
@@ -401,7 +401,7 @@ inline const char *EnumNameOp(Op e) {
return EnumNamesOp()[index];
}
-enum Attribute {
+enum Attribute : uint8_t {
Attribute_NONE = 0,
Attribute_PoolAttribute = 1,
Attribute_ConvAttribute = 2,
@@ -607,8 +607,8 @@ struct PoolAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
verifier.VerifyVector(kernel()) &&
VerifyOffset(verifier, VT_STRIDE) &&
verifier.VerifyVector(stride()) &&
- VerifyField<int32_t>(verifier, VT_INPUT_ZP) &&
- VerifyField<int32_t>(verifier, VT_OUTPUT_ZP) &&
+ VerifyField<int32_t>(verifier, VT_INPUT_ZP, 4) &&
+ VerifyField<int32_t>(verifier, VT_OUTPUT_ZP, 4) &&
verifier.EndTable();
}
};
@@ -636,7 +636,6 @@ struct PoolAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- PoolAttributeBuilder &operator=(const PoolAttributeBuilder &);
flatbuffers::Offset<PoolAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<PoolAttribute>(end);
@@ -711,8 +710,8 @@ struct ConvAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
verifier.VerifyVector(stride()) &&
VerifyOffset(verifier, VT_DILATION) &&
verifier.VerifyVector(dilation()) &&
- VerifyField<int32_t>(verifier, VT_INPUT_ZP) &&
- VerifyField<int32_t>(verifier, VT_WEIGHT_ZP) &&
+ VerifyField<int32_t>(verifier, VT_INPUT_ZP, 4) &&
+ VerifyField<int32_t>(verifier, VT_WEIGHT_ZP, 4) &&
verifier.EndTable();
}
};
@@ -740,7 +739,6 @@ struct ConvAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- ConvAttributeBuilder &operator=(const ConvAttributeBuilder &);
flatbuffers::Offset<ConvAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<ConvAttribute>(end);
@@ -815,8 +813,8 @@ struct TransposeConvAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tab
verifier.VerifyVector(stride()) &&
VerifyOffset(verifier, VT_OUTPUT_SHAPE) &&
verifier.VerifyVector(output_shape()) &&
- VerifyField<int32_t>(verifier, VT_INPUT_ZP) &&
- VerifyField<int32_t>(verifier, VT_WEIGHT_ZP) &&
+ VerifyField<int32_t>(verifier, VT_INPUT_ZP, 4) &&
+ VerifyField<int32_t>(verifier, VT_WEIGHT_ZP, 4) &&
verifier.EndTable();
}
};
@@ -844,7 +842,6 @@ struct TransposeConvAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- TransposeConvAttributeBuilder &operator=(const TransposeConvAttributeBuilder &);
flatbuffers::Offset<TransposeConvAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TransposeConvAttribute>(end);
@@ -907,8 +904,8 @@ struct PadAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_PADDING) &&
verifier.VerifyVector(padding()) &&
- VerifyField<int32_t>(verifier, VT_PAD_CONST_INT) &&
- VerifyField<float>(verifier, VT_PAD_CONST_FP) &&
+ VerifyField<int32_t>(verifier, VT_PAD_CONST_INT, 4) &&
+ VerifyField<float>(verifier, VT_PAD_CONST_FP, 4) &&
verifier.EndTable();
}
};
@@ -930,7 +927,6 @@ struct PadAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- PadAttributeBuilder &operator=(const PadAttributeBuilder &);
flatbuffers::Offset<PadAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<PadAttribute>(end);
@@ -973,7 +969,7 @@ struct AxisAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyField<int32_t>(verifier, VT_AXIS) &&
+ VerifyField<int32_t>(verifier, VT_AXIS, 4) &&
verifier.EndTable();
}
};
@@ -989,7 +985,6 @@ struct AxisAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- AxisAttributeBuilder &operator=(const AxisAttributeBuilder &);
flatbuffers::Offset<AxisAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<AxisAttribute>(end);
@@ -1032,7 +1027,6 @@ struct ReshapeAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- ReshapeAttributeBuilder &operator=(const ReshapeAttributeBuilder &);
flatbuffers::Offset<ReshapeAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<ReshapeAttribute>(end);
@@ -1093,7 +1087,6 @@ struct SliceAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- SliceAttributeBuilder &operator=(const SliceAttributeBuilder &);
flatbuffers::Offset<SliceAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<SliceAttribute>(end);
@@ -1150,7 +1143,6 @@ struct TileAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- TileAttributeBuilder &operator=(const TileAttributeBuilder &);
flatbuffers::Offset<TileAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TileAttribute>(end);
@@ -1178,49 +1170,32 @@ inline flatbuffers::Offset<TileAttribute> CreateTileAttributeDirect(
struct ResizeAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef ResizeAttributeBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
- VT_OUTPUT_SIZE = 4,
- VT_STRIDE = 6,
- VT_OFFSET = 8,
- VT_SHIFT = 10,
- VT_STRIDE_FP = 12,
- VT_OFFSET_FP = 14,
- VT_MODE = 16
+ VT_SCALE = 4,
+ VT_OFFSET = 6,
+ VT_BORDER = 8,
+ VT_MODE = 10
};
- const flatbuffers::Vector<int32_t> *output_size() const {
- return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_OUTPUT_SIZE);
+ const flatbuffers::Vector<int16_t> *scale() const {
+ return GetPointer<const flatbuffers::Vector<int16_t> *>(VT_SCALE);
}
- const flatbuffers::Vector<int32_t> *stride() const {
- return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_STRIDE);
+ const flatbuffers::Vector<int16_t> *offset() const {
+ return GetPointer<const flatbuffers::Vector<int16_t> *>(VT_OFFSET);
}
- const flatbuffers::Vector<int32_t> *offset() const {
- return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_OFFSET);
- }
- int32_t shift() const {
- return GetField<int32_t>(VT_SHIFT, 0);
- }
- const flatbuffers::Vector<float> *stride_fp() const {
- return GetPointer<const flatbuffers::Vector<float> *>(VT_STRIDE_FP);
- }
- const flatbuffers::Vector<float> *offset_fp() const {
- return GetPointer<const flatbuffers::Vector<float> *>(VT_OFFSET_FP);
+ const flatbuffers::Vector<int16_t> *border() const {
+ return GetPointer<const flatbuffers::Vector<int16_t> *>(VT_BORDER);
}
tosa::ResizeMode mode() const {
return static_cast<tosa::ResizeMode>(GetField<uint32_t>(VT_MODE, 0));
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyOffset(verifier, VT_OUTPUT_SIZE) &&
- verifier.VerifyVector(output_size()) &&
- VerifyOffset(verifier, VT_STRIDE) &&
- verifier.VerifyVector(stride()) &&
+ VerifyOffset(verifier, VT_SCALE) &&
+ verifier.VerifyVector(scale()) &&
VerifyOffset(verifier, VT_OFFSET) &&
verifier.VerifyVector(offset()) &&
- VerifyField<int32_t>(verifier, VT_SHIFT) &&
- VerifyOffset(verifier, VT_STRIDE_FP) &&
- verifier.VerifyVector(stride_fp()) &&
- VerifyOffset(verifier, VT_OFFSET_FP) &&
- verifier.VerifyVector(offset_fp()) &&
- VerifyField<uint32_t>(verifier, VT_MODE) &&
+ VerifyOffset(verifier, VT_BORDER) &&
+ verifier.VerifyVector(border()) &&
+ VerifyField<uint32_t>(verifier, VT_MODE, 4) &&
verifier.EndTable();
}
};
@@ -1229,23 +1204,14 @@ struct ResizeAttributeBuilder {
typedef ResizeAttribute Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
- void add_output_size(flatbuffers::Offset<flatbuffers::Vector<int32_t>> output_size) {
- fbb_.AddOffset(ResizeAttribute::VT_OUTPUT_SIZE, output_size);
- }
- void add_stride(flatbuffers::Offset<flatbuffers::Vector<int32_t>> stride) {
- fbb_.AddOffset(ResizeAttribute::VT_STRIDE, stride);
+ void add_scale(flatbuffers::Offset<flatbuffers::Vector<int16_t>> scale) {
+ fbb_.AddOffset(ResizeAttribute::VT_SCALE, scale);
}
- void add_offset(flatbuffers::Offset<flatbuffers::Vector<int32_t>> offset) {
+ void add_offset(flatbuffers::Offset<flatbuffers::Vector<int16_t>> offset) {
fbb_.AddOffset(ResizeAttribute::VT_OFFSET, offset);
}
- void add_shift(int32_t shift) {
- fbb_.AddElement<int32_t>(ResizeAttribute::VT_SHIFT, shift, 0);
- }
- void add_stride_fp(flatbuffers::Offset<flatbuffers::Vector<float>> stride_fp) {
- fbb_.AddOffset(ResizeAttribute::VT_STRIDE_FP, stride_fp);
- }
- void add_offset_fp(flatbuffers::Offset<flatbuffers::Vector<float>> offset_fp) {
- fbb_.AddOffset(ResizeAttribute::VT_OFFSET_FP, offset_fp);
+ void add_border(flatbuffers::Offset<flatbuffers::Vector<int16_t>> border) {
+ fbb_.AddOffset(ResizeAttribute::VT_BORDER, border);
}
void add_mode(tosa::ResizeMode mode) {
fbb_.AddElement<uint32_t>(ResizeAttribute::VT_MODE, static_cast<uint32_t>(mode), 0);
@@ -1254,7 +1220,6 @@ struct ResizeAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- ResizeAttributeBuilder &operator=(const ResizeAttributeBuilder &);
flatbuffers::Offset<ResizeAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<ResizeAttribute>(end);
@@ -1264,46 +1229,32 @@ struct ResizeAttributeBuilder {
inline flatbuffers::Offset<ResizeAttribute> CreateResizeAttribute(
flatbuffers::FlatBufferBuilder &_fbb,
- flatbuffers::Offset<flatbuffers::Vector<int32_t>> output_size = 0,
- flatbuffers::Offset<flatbuffers::Vector<int32_t>> stride = 0,
- flatbuffers::Offset<flatbuffers::Vector<int32_t>> offset = 0,
- int32_t shift = 0,
- flatbuffers::Offset<flatbuffers::Vector<float>> stride_fp = 0,
- flatbuffers::Offset<flatbuffers::Vector<float>> offset_fp = 0,
+ flatbuffers::Offset<flatbuffers::Vector<int16_t>> scale = 0,
+ flatbuffers::Offset<flatbuffers::Vector<int16_t>> offset = 0,
+ flatbuffers::Offset<flatbuffers::Vector<int16_t>> border = 0,
tosa::ResizeMode mode = tosa::ResizeMode_UNKNOWN) {
ResizeAttributeBuilder builder_(_fbb);
builder_.add_mode(mode);
- builder_.add_offset_fp(offset_fp);
- builder_.add_stride_fp(stride_fp);
- builder_.add_shift(shift);
+ builder_.add_border(border);
builder_.add_offset(offset);
- builder_.add_stride(stride);
- builder_.add_output_size(output_size);
+ builder_.add_scale(scale);
return builder_.Finish();
}
inline flatbuffers::Offset<ResizeAttribute> CreateResizeAttributeDirect(
flatbuffers::FlatBufferBuilder &_fbb,
- const std::vector<int32_t> *output_size = nullptr,
- const std::vector<int32_t> *stride = nullptr,
- const std::vector<int32_t> *offset = nullptr,
- int32_t shift = 0,
- const std::vector<float> *stride_fp = nullptr,
- const std::vector<float> *offset_fp = nullptr,
+ const std::vector<int16_t> *scale = nullptr,
+ const std::vector<int16_t> *offset = nullptr,
+ const std::vector<int16_t> *border = nullptr,
tosa::ResizeMode mode = tosa::ResizeMode_UNKNOWN) {
- auto output_size__ = output_size ? _fbb.CreateVector<int32_t>(*output_size) : 0;
- auto stride__ = stride ? _fbb.CreateVector<int32_t>(*stride) : 0;
- auto offset__ = offset ? _fbb.CreateVector<int32_t>(*offset) : 0;
- auto stride_fp__ = stride_fp ? _fbb.CreateVector<float>(*stride_fp) : 0;
- auto offset_fp__ = offset_fp ? _fbb.CreateVector<float>(*offset_fp) : 0;
+ auto scale__ = scale ? _fbb.CreateVector<int16_t>(*scale) : 0;
+ auto offset__ = offset ? _fbb.CreateVector<int16_t>(*offset) : 0;
+ auto border__ = border ? _fbb.CreateVector<int16_t>(*border) : 0;
return tosa::CreateResizeAttribute(
_fbb,
- output_size__,
- stride__,
+ scale__,
offset__,
- shift,
- stride_fp__,
- offset_fp__,
+ border__,
mode);
}
@@ -1329,10 +1280,10 @@ struct ClampAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyField<int32_t>(verifier, VT_MIN_INT) &&
- VerifyField<int32_t>(verifier, VT_MAX_INT) &&
- VerifyField<float>(verifier, VT_MIN_FP) &&
- VerifyField<float>(verifier, VT_MAX_FP) &&
+ VerifyField<int32_t>(verifier, VT_MIN_INT, 4) &&
+ VerifyField<int32_t>(verifier, VT_MAX_INT, 4) &&
+ VerifyField<float>(verifier, VT_MIN_FP, 4) &&
+ VerifyField<float>(verifier, VT_MAX_FP, 4) &&
verifier.EndTable();
}
};
@@ -1357,7 +1308,6 @@ struct ClampAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- ClampAttributeBuilder &operator=(const ClampAttributeBuilder &);
flatbuffers::Offset<ClampAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<ClampAttribute>(end);
@@ -1413,15 +1363,15 @@ struct RescaleAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyField<int32_t>(verifier, VT_INPUT_ZP) &&
- VerifyField<int32_t>(verifier, VT_OUTPUT_ZP) &&
+ VerifyField<int32_t>(verifier, VT_INPUT_ZP, 4) &&
+ VerifyField<int32_t>(verifier, VT_OUTPUT_ZP, 4) &&
VerifyOffset(verifier, VT_MULTIPLIER) &&
verifier.VerifyVector(multiplier()) &&
VerifyOffset(verifier, VT_SHIFT) &&
verifier.VerifyVector(shift()) &&
- VerifyField<uint8_t>(verifier, VT_SCALE32) &&
- VerifyField<uint8_t>(verifier, VT_DOUBLE_ROUND) &&
- VerifyField<uint8_t>(verifier, VT_PER_CHANNEL) &&
+ VerifyField<uint8_t>(verifier, VT_SCALE32, 1) &&
+ VerifyField<uint8_t>(verifier, VT_DOUBLE_ROUND, 1) &&
+ VerifyField<uint8_t>(verifier, VT_PER_CHANNEL, 1) &&
verifier.EndTable();
}
};
@@ -1455,7 +1405,6 @@ struct RescaleAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- RescaleAttributeBuilder &operator=(const RescaleAttributeBuilder &);
flatbuffers::Offset<RescaleAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<RescaleAttribute>(end);
@@ -1515,7 +1464,7 @@ struct MulAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyField<int32_t>(verifier, VT_SHIFT) &&
+ VerifyField<int32_t>(verifier, VT_SHIFT, 4) &&
verifier.EndTable();
}
};
@@ -1531,7 +1480,6 @@ struct MulAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- MulAttributeBuilder &operator=(const MulAttributeBuilder &);
flatbuffers::Offset<MulAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<MulAttribute>(end);
@@ -1557,7 +1505,7 @@ struct ArithmeticRightShiftAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffe
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyField<uint8_t>(verifier, VT_ROUND) &&
+ VerifyField<uint8_t>(verifier, VT_ROUND, 1) &&
verifier.EndTable();
}
};
@@ -1573,7 +1521,6 @@ struct ArithmeticRightShiftAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- ArithmeticRightShiftAttributeBuilder &operator=(const ArithmeticRightShiftAttributeBuilder &);
flatbuffers::Offset<ArithmeticRightShiftAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<ArithmeticRightShiftAttribute>(end);
@@ -1625,7 +1572,6 @@ struct CondIfAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- CondIfAttributeBuilder &operator=(const CondIfAttributeBuilder &);
flatbuffers::Offset<CondIfAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<CondIfAttribute>(end);
@@ -1691,7 +1637,6 @@ struct WhileLoopAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- WhileLoopAttributeBuilder &operator=(const WhileLoopAttributeBuilder &);
flatbuffers::Offset<WhileLoopAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<WhileLoopAttribute>(end);
@@ -1748,7 +1693,6 @@ struct TransposeAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- TransposeAttributeBuilder &operator=(const TransposeAttributeBuilder &);
flatbuffers::Offset<TransposeAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TransposeAttribute>(end);
@@ -1800,7 +1744,6 @@ struct TableAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- TableAttributeBuilder &operator=(const TableAttributeBuilder &);
flatbuffers::Offset<TableAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TableAttribute>(end);
@@ -1839,8 +1782,8 @@ struct MatMulAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyField<int32_t>(verifier, VT_A_ZP) &&
- VerifyField<int32_t>(verifier, VT_B_ZP) &&
+ VerifyField<int32_t>(verifier, VT_A_ZP, 4) &&
+ VerifyField<int32_t>(verifier, VT_B_ZP, 4) &&
verifier.EndTable();
}
};
@@ -1859,7 +1802,6 @@ struct MatMulAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- MatMulAttributeBuilder &operator=(const MatMulAttributeBuilder &);
flatbuffers::Offset<MatMulAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<MatMulAttribute>(end);
@@ -1891,8 +1833,8 @@ struct FullyConnectedAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Ta
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyField<int32_t>(verifier, VT_INPUT_ZP) &&
- VerifyField<int32_t>(verifier, VT_WEIGHT_ZP) &&
+ VerifyField<int32_t>(verifier, VT_INPUT_ZP, 4) &&
+ VerifyField<int32_t>(verifier, VT_WEIGHT_ZP, 4) &&
verifier.EndTable();
}
};
@@ -1911,7 +1853,6 @@ struct FullyConnectedAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- FullyConnectedAttributeBuilder &operator=(const FullyConnectedAttributeBuilder &);
flatbuffers::Offset<FullyConnectedAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<FullyConnectedAttribute>(end);
@@ -1943,8 +1884,8 @@ struct NegateAttribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyField<int32_t>(verifier, VT_INPUT1_ZP) &&
- VerifyField<int32_t>(verifier, VT_OUTPUT_ZP) &&
+ VerifyField<int32_t>(verifier, VT_INPUT1_ZP, 4) &&
+ VerifyField<int32_t>(verifier, VT_OUTPUT_ZP, 4) &&
verifier.EndTable();
}
};
@@ -1963,7 +1904,6 @@ struct NegateAttributeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- NegateAttributeBuilder &operator=(const NegateAttributeBuilder &);
flatbuffers::Offset<NegateAttribute> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<NegateAttribute>(end);
@@ -1993,7 +1933,7 @@ struct Version FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
return GetField<int32_t>(VT__MAJOR, 0);
}
int32_t _minor() const {
- return GetField<int32_t>(VT__MINOR, 31);
+ return GetField<int32_t>(VT__MINOR, 41);
}
int32_t _patch() const {
return GetField<int32_t>(VT__PATCH, 0);
@@ -2003,10 +1943,10 @@ struct Version FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyField<int32_t>(verifier, VT__MAJOR) &&
- VerifyField<int32_t>(verifier, VT__MINOR) &&
- VerifyField<int32_t>(verifier, VT__PATCH) &&
- VerifyField<uint8_t>(verifier, VT__DRAFT) &&
+ VerifyField<int32_t>(verifier, VT__MAJOR, 4) &&
+ VerifyField<int32_t>(verifier, VT__MINOR, 4) &&
+ VerifyField<int32_t>(verifier, VT__PATCH, 4) &&
+ VerifyField<uint8_t>(verifier, VT__DRAFT, 1) &&
verifier.EndTable();
}
};
@@ -2019,7 +1959,7 @@ struct VersionBuilder {
fbb_.AddElement<int32_t>(Version::VT__MAJOR, _major, 0);
}
void add__minor(int32_t _minor) {
- fbb_.AddElement<int32_t>(Version::VT__MINOR, _minor, 31);
+ fbb_.AddElement<int32_t>(Version::VT__MINOR, _minor, 41);
}
void add__patch(int32_t _patch) {
fbb_.AddElement<int32_t>(Version::VT__PATCH, _patch, 0);
@@ -2031,7 +1971,6 @@ struct VersionBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- VersionBuilder &operator=(const VersionBuilder &);
flatbuffers::Offset<Version> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Version>(end);
@@ -2042,7 +1981,7 @@ struct VersionBuilder {
inline flatbuffers::Offset<Version> CreateVersion(
flatbuffers::FlatBufferBuilder &_fbb,
int32_t _major = 0,
- int32_t _minor = 31,
+ int32_t _minor = 41,
int32_t _patch = 0,
bool _draft = true) {
VersionBuilder builder_(_fbb);
@@ -2079,7 +2018,7 @@ struct TosaTensor FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
verifier.VerifyString(name()) &&
VerifyOffset(verifier, VT_SHAPE) &&
verifier.VerifyVector(shape()) &&
- VerifyField<uint32_t>(verifier, VT_TYPE) &&
+ VerifyField<uint32_t>(verifier, VT_TYPE, 4) &&
VerifyOffset(verifier, VT_DATA) &&
verifier.VerifyVector(data()) &&
verifier.EndTable();
@@ -2106,7 +2045,6 @@ struct TosaTensorBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- TosaTensorBuilder &operator=(const TosaTensorBuilder &);
flatbuffers::Offset<TosaTensor> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TosaTensor>(end);
@@ -2233,8 +2171,8 @@ struct TosaOperator FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
- VerifyField<uint32_t>(verifier, VT_OP) &&
- VerifyField<uint8_t>(verifier, VT_ATTRIBUTE_TYPE) &&
+ VerifyField<uint32_t>(verifier, VT_OP, 4) &&
+ VerifyField<uint8_t>(verifier, VT_ATTRIBUTE_TYPE, 1) &&
VerifyOffset(verifier, VT_ATTRIBUTE) &&
VerifyAttribute(verifier, attribute(), attribute_type()) &&
VerifyOffset(verifier, VT_INPUTS) &&
@@ -2350,7 +2288,6 @@ struct TosaOperatorBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- TosaOperatorBuilder &operator=(const TosaOperatorBuilder &);
flatbuffers::Offset<TosaOperator> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TosaOperator>(end);
@@ -2459,7 +2396,6 @@ struct TosaBasicBlockBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- TosaBasicBlockBuilder &operator=(const TosaBasicBlockBuilder &);
flatbuffers::Offset<TosaBasicBlock> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TosaBasicBlock>(end);
@@ -2541,7 +2477,6 @@ struct TosaGraphBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- TosaGraphBuilder &operator=(const TosaGraphBuilder &);
flatbuffers::Offset<TosaGraph> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TosaGraph>(end);
@@ -2688,6 +2623,11 @@ inline bool TosaGraphBufferHasIdentifier(const void *buf) {
buf, TosaGraphIdentifier());
}
+inline bool SizePrefixedTosaGraphBufferHasIdentifier(const void *buf) {
+ return flatbuffers::BufferHasIdentifier(
+ buf, TosaGraphIdentifier(), true);
+}
+
inline bool VerifyTosaGraphBuffer(
flatbuffers::Verifier &verifier) {
return verifier.VerifyBuffer<tosa::TosaGraph>(TosaGraphIdentifier());
diff --git a/include/tosa_serialization_handler.h b/include/tosa_serialization_handler.h
index 53dcf1a..2a992b2 100644
--- a/include/tosa_serialization_handler.h
+++ b/include/tosa_serialization_handler.h
@@ -27,7 +27,7 @@
// Keep version number in sync with the version default value with schema/tosa.fbs
#define TOSA_VERSION_MAJOR 0
-#define TOSA_VERSION_MINOR 31
+#define TOSA_VERSION_MINOR 41
#define TOSA_VERSION_PATCH 0
#define TOSA_VERSION_DRAFT true
#define TENSOR_BUFFER_FORCE_ALIGNMENT 8
diff --git a/python/serializer/tosa_serializer.py b/python/serializer/tosa_serializer.py
index ec1c12d..acec4b7 100644
--- a/python/serializer/tosa_serializer.py
+++ b/python/serializer/tosa_serializer.py
@@ -30,7 +30,7 @@ import tosa.Op as TosaOp
# Keep version number in sync with the version default value with schema/tosa.fbs
TOSA_VERSION_MAJOR = 0
-TOSA_VERSION_MINOR = 31
+TOSA_VERSION_MINOR = 41
TOSA_VERSION_PATCH = 0
TOSA_VERSION_DRAFT = True
TOSA_VERSION = [
@@ -90,6 +90,7 @@ class TosaSerializerUnion:
self.bools = []
self.floats = []
self.strings = []
+ self.int16vecs = []
self.intvecs = []
self.fpvecs = []
@@ -106,6 +107,9 @@ class TosaSerializerUnion:
for fcn, val in self.intvecs:
intVecList.append((fcn, TosaSerializer.serializeInt32Vec(builder, val)))
+ for fcn, val in self.int16vecs:
+ intVecList.append((fcn, TosaSerializer.serializeInt16Vec(builder, val)))
+
for fcn, val in self.fpvecs:
fpVecList.append((fcn, TosaSerializer.serializeFpVec(builder, val)))
@@ -220,20 +224,15 @@ class TosaSerializerAttribute(TosaSerializerUnion):
self.intvecs.append((a.AddMultiples, multiples))
- def ResizeAttribute(
- self, output_size, stride, offset, shift, stride_fp, offset_fp, mode
- ):
+ def ResizeAttribute(self, scale, offset, border, mode):
from tosa import ResizeAttribute as a, Attribute
self.utype = Attribute.Attribute().ResizeAttribute
self.optFcns = (a.Start, a.End)
- self.intvecs.append((a.AddOutputSize, output_size))
- self.intvecs.append((a.AddStride, stride))
- self.intvecs.append((a.AddOffset, offset))
- self.ints.append((a.AddShift, shift))
- self.fpvecs.append((a.AddStrideFp, stride_fp))
- self.fpvecs.append((a.AddOffsetFp, offset_fp))
+ self.int16vecs.append((a.AddScale, scale))
+ self.int16vecs.append((a.AddOffset, offset))
+ self.int16vecs.append((a.AddBorder, border))
self.ints.append((a.AddMode, mode))
def ClampAttribute(self, minint, maxint, minfp, maxfp):
@@ -363,12 +362,17 @@ class TosaSerializerTensor:
self.shape = shape
self.dtype = dtype
+ if dtype == DType.FLOAT:
+ fntype = np.float32
+ else:
+ fntype = int
+
if isinstance(data, np.ndarray):
- data = data.flatten().astype(int).tolist()
- data = list(map(int, data))
+ data = data.flatten().astype(fntype).tolist()
+ data = list(map(fntype, data))
self.data = data
elif isinstance(data, list):
- data = list(map(int, data))
+ data = list(map(fntype, data))
self.data = data
else:
self.data = None
@@ -570,7 +574,7 @@ class TensorDir(IntEnum):
class TosaSerializer:
- def __init__(self, pathPrefix):
+ def __init__(self, pathPrefix, saveConstsToFile=False):
self.add_compat_methods()
# Get the global TOSA version if not already defined
@@ -580,6 +584,9 @@ class TosaSerializer:
self.startBasicBlock("main")
self.pathPrefix = pathPrefix
+ # Enables inspection of constant data outside of graph
+ self.saveConstsToFile = saveConstsToFile
+
# Indicies used for adding/naming tensors
self.currInputIdx = 0
self.currConstIdx = 0
@@ -625,6 +632,10 @@ class TosaSerializer:
# Add the operator now
self.currBasicBlock.addOperator(TosaOp.Op().CONST, [], name)
+ if self.saveConstsToFile:
+ filename = "{}.npy".format(name)
+ np.save(os.path.join(self.pathPrefix, filename), vals, False)
+
return tens
def addIntermediate(self, shape, dtype):
@@ -757,6 +768,16 @@ class TosaSerializer:
return builder.EndVector(len(vec))
@staticmethod
+ def serializeInt16Vec(builder, vec):
+ builder.StartVector(2, len(vec), 4)
+ for v in vec[::-1]:
+ builder.PrependInt16(v)
+ try:
+ return builder.EndVector()
+ except TypeError:
+ return builder.EndVector(len(vec))
+
+ @staticmethod
def serializeInt32Vec(builder, vec):
builder.StartVector(4, len(vec), 4)
for v in vec[::-1]:
@@ -963,26 +984,17 @@ class TosaSerializer:
if not hasattr(ResizeAttribute, "Start"):
ResizeAttribute.Start = ResizeAttribute.ResizeAttributeStart
- ResizeAttribute.AddOutputSize = ResizeAttribute.ResizeAttributeAddOutputSize
- ResizeAttribute.StartOutputSizeVector = (
- ResizeAttribute.ResizeAttributeStartOutputSizeVector
- )
- ResizeAttribute.AddStride = ResizeAttribute.ResizeAttributeAddStride
- ResizeAttribute.StartStrideVector = (
- ResizeAttribute.ResizeAttributeStartStrideVector
+ ResizeAttribute.AddScale = ResizeAttribute.ResizeAttributeAddScale
+ ResizeAttribute.StartScaleVector = (
+ ResizeAttribute.ResizeAttributeStartScaleVector
)
ResizeAttribute.AddOffset = ResizeAttribute.ResizeAttributeAddOffset
ResizeAttribute.StartOffsetVector = (
ResizeAttribute.ResizeAttributeStartOffsetVector
)
- ResizeAttribute.AddShift = ResizeAttribute.ResizeAttributeAddShift
- ResizeAttribute.AddStrideFp = ResizeAttribute.ResizeAttributeAddStrideFp
- ResizeAttribute.StartStrideFpVector = (
- ResizeAttribute.ResizeAttributeStartStrideFpVector
- )
- ResizeAttribute.AddOffsetFp = ResizeAttribute.ResizeAttributeAddOffsetFp
- ResizeAttribute.StartOffsetFpVector = (
- ResizeAttribute.ResizeAttributeStartOffsetFpVector
+ ResizeAttribute.AddBorder = ResizeAttribute.ResizeAttributeAddBorder
+ ResizeAttribute.StartBorderVector = (
+ ResizeAttribute.ResizeAttributeStartBorderVector
)
ResizeAttribute.AddMode = ResizeAttribute.ResizeAttributeAddMode
ResizeAttribute.End = ResizeAttribute.ResizeAttributeEnd
diff --git a/python/tosa/ArithmeticRightShiftAttribute.py b/python/tosa/ArithmeticRightShiftAttribute.py
index 226dc0e..cce8f6b 100644
--- a/python/tosa/ArithmeticRightShiftAttribute.py
+++ b/python/tosa/ArithmeticRightShiftAttribute.py
@@ -10,13 +10,17 @@ class ArithmeticRightShiftAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsArithmeticRightShiftAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = ArithmeticRightShiftAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsArithmeticRightShiftAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def ArithmeticRightShiftAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -32,5 +36,11 @@ class ArithmeticRightShiftAttribute(object):
return False
def ArithmeticRightShiftAttributeStart(builder): builder.StartObject(1)
+def Start(builder):
+ return ArithmeticRightShiftAttributeStart(builder)
def ArithmeticRightShiftAttributeAddRound(builder, round): builder.PrependBoolSlot(0, round, 0)
+def AddRound(builder, round):
+ return ArithmeticRightShiftAttributeAddRound(builder, round)
def ArithmeticRightShiftAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return ArithmeticRightShiftAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/Attribute.py b/python/tosa/Attribute.py
index 166de8e..ec0c7b0 100644
--- a/python/tosa/Attribute.py
+++ b/python/tosa/Attribute.py
@@ -24,4 +24,3 @@ class Attribute(object):
MatMulAttribute = 18
FullyConnectedAttribute = 19
NegateAttribute = 20
-
diff --git a/python/tosa/AxisAttribute.py b/python/tosa/AxisAttribute.py
index 30876b7..1bbd6a0 100644
--- a/python/tosa/AxisAttribute.py
+++ b/python/tosa/AxisAttribute.py
@@ -10,13 +10,17 @@ class AxisAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsAxisAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = AxisAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsAxisAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def AxisAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -32,5 +36,11 @@ class AxisAttribute(object):
return 0
def AxisAttributeStart(builder): builder.StartObject(1)
+def Start(builder):
+ return AxisAttributeStart(builder)
def AxisAttributeAddAxis(builder, axis): builder.PrependInt32Slot(0, axis, 0)
+def AddAxis(builder, axis):
+ return AxisAttributeAddAxis(builder, axis)
def AxisAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return AxisAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/ClampAttribute.py b/python/tosa/ClampAttribute.py
index 066dd4f..58d1f0a 100644
--- a/python/tosa/ClampAttribute.py
+++ b/python/tosa/ClampAttribute.py
@@ -10,13 +10,17 @@ class ClampAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsClampAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = ClampAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsClampAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def ClampAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -53,8 +57,20 @@ class ClampAttribute(object):
return 0.0
def ClampAttributeStart(builder): builder.StartObject(4)
+def Start(builder):
+ return ClampAttributeStart(builder)
def ClampAttributeAddMinInt(builder, minInt): builder.PrependInt32Slot(0, minInt, 0)
+def AddMinInt(builder, minInt):
+ return ClampAttributeAddMinInt(builder, minInt)
def ClampAttributeAddMaxInt(builder, maxInt): builder.PrependInt32Slot(1, maxInt, 0)
+def AddMaxInt(builder, maxInt):
+ return ClampAttributeAddMaxInt(builder, maxInt)
def ClampAttributeAddMinFp(builder, minFp): builder.PrependFloat32Slot(2, minFp, 0.0)
+def AddMinFp(builder, minFp):
+ return ClampAttributeAddMinFp(builder, minFp)
def ClampAttributeAddMaxFp(builder, maxFp): builder.PrependFloat32Slot(3, maxFp, 0.0)
+def AddMaxFp(builder, maxFp):
+ return ClampAttributeAddMaxFp(builder, maxFp)
def ClampAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return ClampAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/CondIfAttribute.py b/python/tosa/CondIfAttribute.py
index 57e5cb7..fddf5d9 100644
--- a/python/tosa/CondIfAttribute.py
+++ b/python/tosa/CondIfAttribute.py
@@ -10,13 +10,17 @@ class CondIfAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsCondIfAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = CondIfAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsCondIfAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def CondIfAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -39,6 +43,14 @@ class CondIfAttribute(object):
return None
def CondIfAttributeStart(builder): builder.StartObject(2)
+def Start(builder):
+ return CondIfAttributeStart(builder)
def CondIfAttributeAddThenBranch(builder, thenBranch): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(thenBranch), 0)
+def AddThenBranch(builder, thenBranch):
+ return CondIfAttributeAddThenBranch(builder, thenBranch)
def CondIfAttributeAddElseBranch(builder, elseBranch): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(elseBranch), 0)
+def AddElseBranch(builder, elseBranch):
+ return CondIfAttributeAddElseBranch(builder, elseBranch)
def CondIfAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return CondIfAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/ConvAttribute.py b/python/tosa/ConvAttribute.py
index 8244ea5..fb22c7a 100644
--- a/python/tosa/ConvAttribute.py
+++ b/python/tosa/ConvAttribute.py
@@ -10,13 +10,17 @@ class ConvAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsConvAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = ConvAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsConvAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def ConvAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -120,12 +124,32 @@ class ConvAttribute(object):
return 0
def ConvAttributeStart(builder): builder.StartObject(5)
+def Start(builder):
+ return ConvAttributeStart(builder)
def ConvAttributeAddPad(builder, pad): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pad), 0)
+def AddPad(builder, pad):
+ return ConvAttributeAddPad(builder, pad)
def ConvAttributeStartPadVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartPadVector(builder, numElems):
+ return ConvAttributeStartPadVector(builder, numElems)
def ConvAttributeAddStride(builder, stride): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stride), 0)
+def AddStride(builder, stride):
+ return ConvAttributeAddStride(builder, stride)
def ConvAttributeStartStrideVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartStrideVector(builder, numElems):
+ return ConvAttributeStartStrideVector(builder, numElems)
def ConvAttributeAddDilation(builder, dilation): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(dilation), 0)
+def AddDilation(builder, dilation):
+ return ConvAttributeAddDilation(builder, dilation)
def ConvAttributeStartDilationVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartDilationVector(builder, numElems):
+ return ConvAttributeStartDilationVector(builder, numElems)
def ConvAttributeAddInputZp(builder, inputZp): builder.PrependInt32Slot(3, inputZp, 0)
+def AddInputZp(builder, inputZp):
+ return ConvAttributeAddInputZp(builder, inputZp)
def ConvAttributeAddWeightZp(builder, weightZp): builder.PrependInt32Slot(4, weightZp, 0)
+def AddWeightZp(builder, weightZp):
+ return ConvAttributeAddWeightZp(builder, weightZp)
def ConvAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return ConvAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/DType.py b/python/tosa/DType.py
index ad9048b..e6b41ed 100644
--- a/python/tosa/DType.py
+++ b/python/tosa/DType.py
@@ -13,4 +13,3 @@ class DType(object):
INT48 = 7
FLOAT = 8
UINT16 = 9
-
diff --git a/python/tosa/FullyConnectedAttribute.py b/python/tosa/FullyConnectedAttribute.py
index 62b480d..892b0da 100644
--- a/python/tosa/FullyConnectedAttribute.py
+++ b/python/tosa/FullyConnectedAttribute.py
@@ -10,13 +10,17 @@ class FullyConnectedAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsFullyConnectedAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = FullyConnectedAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsFullyConnectedAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def FullyConnectedAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -39,6 +43,14 @@ class FullyConnectedAttribute(object):
return 0
def FullyConnectedAttributeStart(builder): builder.StartObject(2)
+def Start(builder):
+ return FullyConnectedAttributeStart(builder)
def FullyConnectedAttributeAddInputZp(builder, inputZp): builder.PrependInt32Slot(0, inputZp, 0)
+def AddInputZp(builder, inputZp):
+ return FullyConnectedAttributeAddInputZp(builder, inputZp)
def FullyConnectedAttributeAddWeightZp(builder, weightZp): builder.PrependInt32Slot(1, weightZp, 0)
+def AddWeightZp(builder, weightZp):
+ return FullyConnectedAttributeAddWeightZp(builder, weightZp)
def FullyConnectedAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return FullyConnectedAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/MatMulAttribute.py b/python/tosa/MatMulAttribute.py
index 601f13f..b42ebfa 100644
--- a/python/tosa/MatMulAttribute.py
+++ b/python/tosa/MatMulAttribute.py
@@ -10,13 +10,17 @@ class MatMulAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsMatMulAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = MatMulAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsMatMulAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def MatMulAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -39,6 +43,14 @@ class MatMulAttribute(object):
return 0
def MatMulAttributeStart(builder): builder.StartObject(2)
+def Start(builder):
+ return MatMulAttributeStart(builder)
def MatMulAttributeAddAZp(builder, aZp): builder.PrependInt32Slot(0, aZp, 0)
+def AddAZp(builder, aZp):
+ return MatMulAttributeAddAZp(builder, aZp)
def MatMulAttributeAddBZp(builder, bZp): builder.PrependInt32Slot(1, bZp, 0)
+def AddBZp(builder, bZp):
+ return MatMulAttributeAddBZp(builder, bZp)
def MatMulAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return MatMulAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/MulAttribute.py b/python/tosa/MulAttribute.py
index 79be4d3..789914c 100644
--- a/python/tosa/MulAttribute.py
+++ b/python/tosa/MulAttribute.py
@@ -10,13 +10,17 @@ class MulAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsMulAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = MulAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsMulAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def MulAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -32,5 +36,11 @@ class MulAttribute(object):
return 0
def MulAttributeStart(builder): builder.StartObject(1)
+def Start(builder):
+ return MulAttributeStart(builder)
def MulAttributeAddShift(builder, shift): builder.PrependInt32Slot(0, shift, 0)
+def AddShift(builder, shift):
+ return MulAttributeAddShift(builder, shift)
def MulAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return MulAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/NegateAttribute.py b/python/tosa/NegateAttribute.py
index 24a57dc..964c836 100644
--- a/python/tosa/NegateAttribute.py
+++ b/python/tosa/NegateAttribute.py
@@ -10,13 +10,17 @@ class NegateAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsNegateAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = NegateAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsNegateAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def NegateAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -39,6 +43,14 @@ class NegateAttribute(object):
return 0
def NegateAttributeStart(builder): builder.StartObject(2)
+def Start(builder):
+ return NegateAttributeStart(builder)
def NegateAttributeAddInput1Zp(builder, input1Zp): builder.PrependInt32Slot(0, input1Zp, 0)
+def AddInput1Zp(builder, input1Zp):
+ return NegateAttributeAddInput1Zp(builder, input1Zp)
def NegateAttributeAddOutputZp(builder, outputZp): builder.PrependInt32Slot(1, outputZp, 0)
+def AddOutputZp(builder, outputZp):
+ return NegateAttributeAddOutputZp(builder, outputZp)
def NegateAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return NegateAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/Op.py b/python/tosa/Op.py
index 181e457..6b4c7b0 100644
--- a/python/tosa/Op.py
+++ b/python/tosa/Op.py
@@ -72,4 +72,3 @@ class Op(object):
CUSTOM = 66
COND_IF = 67
WHILE_LOOP = 68
-
diff --git a/python/tosa/PadAttribute.py b/python/tosa/PadAttribute.py
index 0875481..8d49d5a 100644
--- a/python/tosa/PadAttribute.py
+++ b/python/tosa/PadAttribute.py
@@ -10,13 +10,17 @@ class PadAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsPadAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = PadAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsPadAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def PadAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -66,8 +70,20 @@ class PadAttribute(object):
return 0.0
def PadAttributeStart(builder): builder.StartObject(3)
+def Start(builder):
+ return PadAttributeStart(builder)
def PadAttributeAddPadding(builder, padding): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(padding), 0)
+def AddPadding(builder, padding):
+ return PadAttributeAddPadding(builder, padding)
def PadAttributeStartPaddingVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartPaddingVector(builder, numElems):
+ return PadAttributeStartPaddingVector(builder, numElems)
def PadAttributeAddPadConstInt(builder, padConstInt): builder.PrependInt32Slot(1, padConstInt, 0)
+def AddPadConstInt(builder, padConstInt):
+ return PadAttributeAddPadConstInt(builder, padConstInt)
def PadAttributeAddPadConstFp(builder, padConstFp): builder.PrependFloat32Slot(2, padConstFp, 0.0)
+def AddPadConstFp(builder, padConstFp):
+ return PadAttributeAddPadConstFp(builder, padConstFp)
def PadAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return PadAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/PoolAttribute.py b/python/tosa/PoolAttribute.py
index 8b6903e..8256a6d 100644
--- a/python/tosa/PoolAttribute.py
+++ b/python/tosa/PoolAttribute.py
@@ -10,13 +10,17 @@ class PoolAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsPoolAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = PoolAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsPoolAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def PoolAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -120,12 +124,32 @@ class PoolAttribute(object):
return 0
def PoolAttributeStart(builder): builder.StartObject(5)
+def Start(builder):
+ return PoolAttributeStart(builder)
def PoolAttributeAddPad(builder, pad): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pad), 0)
+def AddPad(builder, pad):
+ return PoolAttributeAddPad(builder, pad)
def PoolAttributeStartPadVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartPadVector(builder, numElems):
+ return PoolAttributeStartPadVector(builder, numElems)
def PoolAttributeAddKernel(builder, kernel): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(kernel), 0)
+def AddKernel(builder, kernel):
+ return PoolAttributeAddKernel(builder, kernel)
def PoolAttributeStartKernelVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartKernelVector(builder, numElems):
+ return PoolAttributeStartKernelVector(builder, numElems)
def PoolAttributeAddStride(builder, stride): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(stride), 0)
+def AddStride(builder, stride):
+ return PoolAttributeAddStride(builder, stride)
def PoolAttributeStartStrideVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartStrideVector(builder, numElems):
+ return PoolAttributeStartStrideVector(builder, numElems)
def PoolAttributeAddInputZp(builder, inputZp): builder.PrependInt32Slot(3, inputZp, 0)
+def AddInputZp(builder, inputZp):
+ return PoolAttributeAddInputZp(builder, inputZp)
def PoolAttributeAddOutputZp(builder, outputZp): builder.PrependInt32Slot(4, outputZp, 0)
+def AddOutputZp(builder, outputZp):
+ return PoolAttributeAddOutputZp(builder, outputZp)
def PoolAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return PoolAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/RescaleAttribute.py b/python/tosa/RescaleAttribute.py
index 8ba68aa..893c6ec 100644
--- a/python/tosa/RescaleAttribute.py
+++ b/python/tosa/RescaleAttribute.py
@@ -10,13 +10,17 @@ class RescaleAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsRescaleAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = RescaleAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsRescaleAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def RescaleAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -114,13 +118,35 @@ class RescaleAttribute(object):
return False
def RescaleAttributeStart(builder): builder.StartObject(7)
+def Start(builder):
+ return RescaleAttributeStart(builder)
def RescaleAttributeAddInputZp(builder, inputZp): builder.PrependInt32Slot(0, inputZp, 0)
+def AddInputZp(builder, inputZp):
+ return RescaleAttributeAddInputZp(builder, inputZp)
def RescaleAttributeAddOutputZp(builder, outputZp): builder.PrependInt32Slot(1, outputZp, 0)
+def AddOutputZp(builder, outputZp):
+ return RescaleAttributeAddOutputZp(builder, outputZp)
def RescaleAttributeAddMultiplier(builder, multiplier): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(multiplier), 0)
+def AddMultiplier(builder, multiplier):
+ return RescaleAttributeAddMultiplier(builder, multiplier)
def RescaleAttributeStartMultiplierVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartMultiplierVector(builder, numElems):
+ return RescaleAttributeStartMultiplierVector(builder, numElems)
def RescaleAttributeAddShift(builder, shift): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(shift), 0)
+def AddShift(builder, shift):
+ return RescaleAttributeAddShift(builder, shift)
def RescaleAttributeStartShiftVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartShiftVector(builder, numElems):
+ return RescaleAttributeStartShiftVector(builder, numElems)
def RescaleAttributeAddScale32(builder, scale32): builder.PrependBoolSlot(4, scale32, 0)
+def AddScale32(builder, scale32):
+ return RescaleAttributeAddScale32(builder, scale32)
def RescaleAttributeAddDoubleRound(builder, doubleRound): builder.PrependBoolSlot(5, doubleRound, 0)
+def AddDoubleRound(builder, doubleRound):
+ return RescaleAttributeAddDoubleRound(builder, doubleRound)
def RescaleAttributeAddPerChannel(builder, perChannel): builder.PrependBoolSlot(6, perChannel, 0)
+def AddPerChannel(builder, perChannel):
+ return RescaleAttributeAddPerChannel(builder, perChannel)
def RescaleAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return RescaleAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/ReshapeAttribute.py b/python/tosa/ReshapeAttribute.py
index 73b1ee8..a6e6860 100644
--- a/python/tosa/ReshapeAttribute.py
+++ b/python/tosa/ReshapeAttribute.py
@@ -10,13 +10,17 @@ class ReshapeAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsReshapeAttribute(cls, buf, offset):
+ 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)
@@ -52,6 +56,14 @@ class ReshapeAttribute(object):
return o == 0
def ReshapeAttributeStart(builder): builder.StartObject(1)
+def Start(builder):
+ return ReshapeAttributeStart(builder)
def ReshapeAttributeAddNewShape(builder, newShape): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(newShape), 0)
+def AddNewShape(builder, newShape):
+ return ReshapeAttributeAddNewShape(builder, newShape)
def ReshapeAttributeStartNewShapeVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartNewShapeVector(builder, numElems):
+ return ReshapeAttributeStartNewShapeVector(builder, numElems)
def ReshapeAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return ReshapeAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/ResizeAttribute.py b/python/tosa/ResizeAttribute.py
index 1ed2dc0..16b0924 100644
--- a/python/tosa/ResizeAttribute.py
+++ b/python/tosa/ResizeAttribute.py
@@ -10,13 +10,17 @@ class ResizeAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsResizeAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = ResizeAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsResizeAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def ResizeAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -25,165 +29,117 @@ class ResizeAttribute(object):
self._tab = flatbuffers.table.Table(buf, pos)
# ResizeAttribute
- def OutputSize(self, j):
+ def Scale(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 self._tab.Get(flatbuffers.number_types.Int16Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 2))
return 0
# ResizeAttribute
- def OutputSizeAsNumpy(self):
+ def ScaleAsNumpy(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 self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int16Flags, o)
return 0
# ResizeAttribute
- def OutputSizeLength(self):
+ def ScaleLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.VectorLen(o)
return 0
# ResizeAttribute
- def OutputSizeIsNone(self):
+ def ScaleIsNone(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
return o == 0
# ResizeAttribute
- def Stride(self, j):
+ def Offset(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 self._tab.Get(flatbuffers.number_types.Int16Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 2))
return 0
# ResizeAttribute
- def StrideAsNumpy(self):
+ def OffsetAsNumpy(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 self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int16Flags, o)
return 0
# ResizeAttribute
- def StrideLength(self):
+ def OffsetLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.VectorLen(o)
return 0
# ResizeAttribute
- def StrideIsNone(self):
+ def OffsetIsNone(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
return o == 0
# ResizeAttribute
- def Offset(self, j):
+ def Border(self, j):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
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 self._tab.Get(flatbuffers.number_types.Int16Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 2))
return 0
# ResizeAttribute
- def OffsetAsNumpy(self):
+ def BorderAsNumpy(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
- return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
+ return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int16Flags, o)
return 0
# ResizeAttribute
- def OffsetLength(self):
+ def BorderLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
return self._tab.VectorLen(o)
return 0
# ResizeAttribute
- def OffsetIsNone(self):
+ def BorderIsNone(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
return o == 0
# ResizeAttribute
- def Shift(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
- if o != 0:
- return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
- return 0
-
- # ResizeAttribute
- def StrideFp(self, j):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
- if o != 0:
- a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
- return 0
-
- # ResizeAttribute
- def StrideFpAsNumpy(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
- if o != 0:
- return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
- return 0
-
- # ResizeAttribute
- def StrideFpLength(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
- if o != 0:
- return self._tab.VectorLen(o)
- return 0
-
- # ResizeAttribute
- def StrideFpIsNone(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
- return o == 0
-
- # ResizeAttribute
- def OffsetFp(self, j):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
- if o != 0:
- a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
- return 0
-
- # ResizeAttribute
- def OffsetFpAsNumpy(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
- if o != 0:
- return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
- return 0
-
- # ResizeAttribute
- def OffsetFpLength(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
- if o != 0:
- return self._tab.VectorLen(o)
- return 0
-
- # ResizeAttribute
- def OffsetFpIsNone(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
- return o == 0
-
- # ResizeAttribute
def Mode(self):
- o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
return 0
-def ResizeAttributeStart(builder): builder.StartObject(7)
-def ResizeAttributeAddOutputSize(builder, outputSize): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(outputSize), 0)
-def ResizeAttributeStartOutputSizeVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ResizeAttributeAddStride(builder, stride): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stride), 0)
-def ResizeAttributeStartStrideVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ResizeAttributeAddOffset(builder, offset): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(offset), 0)
-def ResizeAttributeStartOffsetVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ResizeAttributeAddShift(builder, shift): builder.PrependInt32Slot(3, shift, 0)
-def ResizeAttributeAddStrideFp(builder, strideFp): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(strideFp), 0)
-def ResizeAttributeStartStrideFpVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ResizeAttributeAddOffsetFp(builder, offsetFp): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(offsetFp), 0)
-def ResizeAttributeStartOffsetFpVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ResizeAttributeAddMode(builder, mode): builder.PrependUint32Slot(6, mode, 0)
+def ResizeAttributeStart(builder): builder.StartObject(4)
+def Start(builder):
+ return ResizeAttributeStart(builder)
+def ResizeAttributeAddScale(builder, scale): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(scale), 0)
+def AddScale(builder, scale):
+ return ResizeAttributeAddScale(builder, scale)
+def ResizeAttributeStartScaleVector(builder, numElems): return builder.StartVector(2, numElems, 2)
+def StartScaleVector(builder, numElems):
+ return ResizeAttributeStartScaleVector(builder, numElems)
+def ResizeAttributeAddOffset(builder, offset): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(offset), 0)
+def AddOffset(builder, offset):
+ return ResizeAttributeAddOffset(builder, offset)
+def ResizeAttributeStartOffsetVector(builder, numElems): return builder.StartVector(2, numElems, 2)
+def StartOffsetVector(builder, numElems):
+ return ResizeAttributeStartOffsetVector(builder, numElems)
+def ResizeAttributeAddBorder(builder, border): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(border), 0)
+def AddBorder(builder, border):
+ return ResizeAttributeAddBorder(builder, border)
+def ResizeAttributeStartBorderVector(builder, numElems): return builder.StartVector(2, numElems, 2)
+def StartBorderVector(builder, numElems):
+ return ResizeAttributeStartBorderVector(builder, numElems)
+def ResizeAttributeAddMode(builder, mode): builder.PrependUint32Slot(3, mode, 0)
+def AddMode(builder, mode):
+ return ResizeAttributeAddMode(builder, mode)
def ResizeAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return ResizeAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/ResizeMode.py b/python/tosa/ResizeMode.py
index 65bcd5d..388ecda 100644
--- a/python/tosa/ResizeMode.py
+++ b/python/tosa/ResizeMode.py
@@ -6,4 +6,3 @@ class ResizeMode(object):
UNKNOWN = 0
NEAREST = 1
BILINEAR = 2
-
diff --git a/python/tosa/SliceAttribute.py b/python/tosa/SliceAttribute.py
index d3f6073..8ce282a 100644
--- a/python/tosa/SliceAttribute.py
+++ b/python/tosa/SliceAttribute.py
@@ -10,13 +10,17 @@ class SliceAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsSliceAttribute(cls, buf, offset):
+ 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)
@@ -79,8 +83,20 @@ class SliceAttribute(object):
return o == 0
def SliceAttributeStart(builder): builder.StartObject(2)
+def Start(builder):
+ return SliceAttributeStart(builder)
def SliceAttributeAddStart(builder, start): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(start), 0)
+def AddStart(builder, start):
+ return SliceAttributeAddStart(builder, start)
def SliceAttributeStartStartVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartStartVector(builder, numElems):
+ return SliceAttributeStartStartVector(builder, numElems)
def SliceAttributeAddSize(builder, size): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(size), 0)
+def AddSize(builder, size):
+ return SliceAttributeAddSize(builder, size)
def SliceAttributeStartSizeVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartSizeVector(builder, numElems):
+ return SliceAttributeStartSizeVector(builder, numElems)
def SliceAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return SliceAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/TableAttribute.py b/python/tosa/TableAttribute.py
index 49a5c9a..fc17241 100644
--- a/python/tosa/TableAttribute.py
+++ b/python/tosa/TableAttribute.py
@@ -10,13 +10,17 @@ class TableAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTableAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TableAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsTableAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def TableAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -52,6 +56,14 @@ class TableAttribute(object):
return o == 0
def TableAttributeStart(builder): builder.StartObject(1)
+def Start(builder):
+ return TableAttributeStart(builder)
def TableAttributeAddTable(builder, table): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(table), 0)
+def AddTable(builder, table):
+ return TableAttributeAddTable(builder, table)
def TableAttributeStartTableVector(builder, numElems): return builder.StartVector(2, numElems, 2)
+def StartTableVector(builder, numElems):
+ return TableAttributeStartTableVector(builder, numElems)
def TableAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return TableAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/TileAttribute.py b/python/tosa/TileAttribute.py
index 03dd0fb..c2ab92f 100644
--- a/python/tosa/TileAttribute.py
+++ b/python/tosa/TileAttribute.py
@@ -10,13 +10,17 @@ class TileAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTileAttribute(cls, buf, offset):
+ 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)
@@ -52,6 +56,14 @@ class TileAttribute(object):
return o == 0
def TileAttributeStart(builder): builder.StartObject(1)
+def Start(builder):
+ return TileAttributeStart(builder)
def TileAttributeAddMultiples(builder, multiples): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(multiples), 0)
+def AddMultiples(builder, multiples):
+ return TileAttributeAddMultiples(builder, multiples)
def TileAttributeStartMultiplesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartMultiplesVector(builder, numElems):
+ return TileAttributeStartMultiplesVector(builder, numElems)
def TileAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return TileAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/TosaBasicBlock.py b/python/tosa/TosaBasicBlock.py
index 1c93c63..164153b 100644
--- a/python/tosa/TosaBasicBlock.py
+++ b/python/tosa/TosaBasicBlock.py
@@ -10,13 +10,17 @@ class TosaBasicBlock(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTosaBasicBlock(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TosaBasicBlock()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsTosaBasicBlock(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def TosaBasicBlockBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -122,13 +126,35 @@ class TosaBasicBlock(object):
return o == 0
def TosaBasicBlockStart(builder): builder.StartObject(5)
+def Start(builder):
+ return TosaBasicBlockStart(builder)
def TosaBasicBlockAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
+def AddName(builder, name):
+ return TosaBasicBlockAddName(builder, name)
def TosaBasicBlockAddOperators(builder, operators): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(operators), 0)
+def AddOperators(builder, operators):
+ return TosaBasicBlockAddOperators(builder, operators)
def TosaBasicBlockStartOperatorsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartOperatorsVector(builder, numElems):
+ return TosaBasicBlockStartOperatorsVector(builder, numElems)
def TosaBasicBlockAddTensors(builder, tensors): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(tensors), 0)
+def AddTensors(builder, tensors):
+ return TosaBasicBlockAddTensors(builder, tensors)
def TosaBasicBlockStartTensorsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartTensorsVector(builder, numElems):
+ return TosaBasicBlockStartTensorsVector(builder, numElems)
def TosaBasicBlockAddInputs(builder, inputs): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0)
+def AddInputs(builder, inputs):
+ return TosaBasicBlockAddInputs(builder, inputs)
def TosaBasicBlockStartInputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartInputsVector(builder, numElems):
+ return TosaBasicBlockStartInputsVector(builder, numElems)
def TosaBasicBlockAddOutputs(builder, outputs): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0)
+def AddOutputs(builder, outputs):
+ return TosaBasicBlockAddOutputs(builder, outputs)
def TosaBasicBlockStartOutputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartOutputsVector(builder, numElems):
+ return TosaBasicBlockStartOutputsVector(builder, numElems)
def TosaBasicBlockEnd(builder): return builder.EndObject()
+def End(builder):
+ return TosaBasicBlockEnd(builder) \ No newline at end of file
diff --git a/python/tosa/TosaGraph.py b/python/tosa/TosaGraph.py
index eceffdb..164cef2 100644
--- a/python/tosa/TosaGraph.py
+++ b/python/tosa/TosaGraph.py
@@ -10,13 +10,17 @@ class TosaGraph(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTosaGraph(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TosaGraph()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsTosaGraph(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def TosaGraphBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -61,7 +65,17 @@ class TosaGraph(object):
return o == 0
def TosaGraphStart(builder): builder.StartObject(2)
+def Start(builder):
+ return TosaGraphStart(builder)
def TosaGraphAddVersion(builder, version): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(version), 0)
+def AddVersion(builder, version):
+ return TosaGraphAddVersion(builder, version)
def TosaGraphAddBlocks(builder, blocks): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(blocks), 0)
+def AddBlocks(builder, blocks):
+ return TosaGraphAddBlocks(builder, blocks)
def TosaGraphStartBlocksVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartBlocksVector(builder, numElems):
+ return TosaGraphStartBlocksVector(builder, numElems)
def TosaGraphEnd(builder): return builder.EndObject()
+def End(builder):
+ return TosaGraphEnd(builder) \ No newline at end of file
diff --git a/python/tosa/TosaOperator.py b/python/tosa/TosaOperator.py
index fd11f76..034b336 100644
--- a/python/tosa/TosaOperator.py
+++ b/python/tosa/TosaOperator.py
@@ -10,13 +10,17 @@ class TosaOperator(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTosaOperator(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TosaOperator()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsTosaOperator(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def TosaOperatorBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -89,11 +93,29 @@ class TosaOperator(object):
return o == 0
def TosaOperatorStart(builder): builder.StartObject(5)
+def Start(builder):
+ return TosaOperatorStart(builder)
def TosaOperatorAddOp(builder, op): builder.PrependUint32Slot(0, op, 0)
+def AddOp(builder, op):
+ return TosaOperatorAddOp(builder, op)
def TosaOperatorAddAttributeType(builder, attributeType): builder.PrependUint8Slot(1, attributeType, 0)
+def AddAttributeType(builder, attributeType):
+ return TosaOperatorAddAttributeType(builder, attributeType)
def TosaOperatorAddAttribute(builder, attribute): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(attribute), 0)
+def AddAttribute(builder, attribute):
+ return TosaOperatorAddAttribute(builder, attribute)
def TosaOperatorAddInputs(builder, inputs): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0)
+def AddInputs(builder, inputs):
+ return TosaOperatorAddInputs(builder, inputs)
def TosaOperatorStartInputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartInputsVector(builder, numElems):
+ return TosaOperatorStartInputsVector(builder, numElems)
def TosaOperatorAddOutputs(builder, outputs): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0)
+def AddOutputs(builder, outputs):
+ return TosaOperatorAddOutputs(builder, outputs)
def TosaOperatorStartOutputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartOutputsVector(builder, numElems):
+ return TosaOperatorStartOutputsVector(builder, numElems)
def TosaOperatorEnd(builder): return builder.EndObject()
+def End(builder):
+ return TosaOperatorEnd(builder) \ No newline at end of file
diff --git a/python/tosa/TosaTensor.py b/python/tosa/TosaTensor.py
index a6f609d..d8ee267 100644
--- a/python/tosa/TosaTensor.py
+++ b/python/tosa/TosaTensor.py
@@ -10,13 +10,17 @@ class TosaTensor(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTosaTensor(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TosaTensor()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsTosaTensor(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def TosaTensorBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -93,10 +97,26 @@ class TosaTensor(object):
return o == 0
def TosaTensorStart(builder): builder.StartObject(4)
+def Start(builder):
+ return TosaTensorStart(builder)
def TosaTensorAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
+def AddName(builder, name):
+ return TosaTensorAddName(builder, name)
def TosaTensorAddShape(builder, shape): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(shape), 0)
+def AddShape(builder, shape):
+ return TosaTensorAddShape(builder, shape)
def TosaTensorStartShapeVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartShapeVector(builder, numElems):
+ return TosaTensorStartShapeVector(builder, numElems)
def TosaTensorAddType(builder, type): builder.PrependUint32Slot(2, type, 0)
+def AddType(builder, type):
+ return TosaTensorAddType(builder, type)
def TosaTensorAddData(builder, data): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0)
+def AddData(builder, data):
+ return TosaTensorAddData(builder, data)
def TosaTensorStartDataVector(builder, numElems): return builder.StartVector(1, numElems, 1)
+def StartDataVector(builder, numElems):
+ return TosaTensorStartDataVector(builder, numElems)
def TosaTensorEnd(builder): return builder.EndObject()
+def End(builder):
+ return TosaTensorEnd(builder) \ No newline at end of file
diff --git a/python/tosa/TransposeAttribute.py b/python/tosa/TransposeAttribute.py
index 82e6b3a..cf02bfc 100644
--- a/python/tosa/TransposeAttribute.py
+++ b/python/tosa/TransposeAttribute.py
@@ -10,13 +10,17 @@ class TransposeAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTransposeAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TransposeAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsTransposeAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def TransposeAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -52,6 +56,14 @@ class TransposeAttribute(object):
return o == 0
def TransposeAttributeStart(builder): builder.StartObject(1)
+def Start(builder):
+ return TransposeAttributeStart(builder)
def TransposeAttributeAddPerms(builder, perms): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(perms), 0)
+def AddPerms(builder, perms):
+ return TransposeAttributeAddPerms(builder, perms)
def TransposeAttributeStartPermsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartPermsVector(builder, numElems):
+ return TransposeAttributeStartPermsVector(builder, numElems)
def TransposeAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return TransposeAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/TransposeConvAttribute.py b/python/tosa/TransposeConvAttribute.py
index 8ca5ba7..a2824e2 100644
--- a/python/tosa/TransposeConvAttribute.py
+++ b/python/tosa/TransposeConvAttribute.py
@@ -10,13 +10,17 @@ class TransposeConvAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTransposeConvAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TransposeConvAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsTransposeConvAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def TransposeConvAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -120,12 +124,32 @@ class TransposeConvAttribute(object):
return 0
def TransposeConvAttributeStart(builder): builder.StartObject(5)
+def Start(builder):
+ return TransposeConvAttributeStart(builder)
def TransposeConvAttributeAddOutPad(builder, outPad): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(outPad), 0)
+def AddOutPad(builder, outPad):
+ return TransposeConvAttributeAddOutPad(builder, outPad)
def TransposeConvAttributeStartOutPadVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartOutPadVector(builder, numElems):
+ return TransposeConvAttributeStartOutPadVector(builder, numElems)
def TransposeConvAttributeAddStride(builder, stride): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stride), 0)
+def AddStride(builder, stride):
+ return TransposeConvAttributeAddStride(builder, stride)
def TransposeConvAttributeStartStrideVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartStrideVector(builder, numElems):
+ return TransposeConvAttributeStartStrideVector(builder, numElems)
def TransposeConvAttributeAddOutputShape(builder, outputShape): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(outputShape), 0)
+def AddOutputShape(builder, outputShape):
+ return TransposeConvAttributeAddOutputShape(builder, outputShape)
def TransposeConvAttributeStartOutputShapeVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartOutputShapeVector(builder, numElems):
+ return TransposeConvAttributeStartOutputShapeVector(builder, numElems)
def TransposeConvAttributeAddInputZp(builder, inputZp): builder.PrependInt32Slot(3, inputZp, 0)
+def AddInputZp(builder, inputZp):
+ return TransposeConvAttributeAddInputZp(builder, inputZp)
def TransposeConvAttributeAddWeightZp(builder, weightZp): builder.PrependInt32Slot(4, weightZp, 0)
+def AddWeightZp(builder, weightZp):
+ return TransposeConvAttributeAddWeightZp(builder, weightZp)
def TransposeConvAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return TransposeConvAttributeEnd(builder) \ No newline at end of file
diff --git a/python/tosa/Version.py b/python/tosa/Version.py
index 06c3ba3..1eaa351 100644
--- a/python/tosa/Version.py
+++ b/python/tosa/Version.py
@@ -10,13 +10,17 @@ class Version(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsVersion(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Version()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsVersion(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def VersionBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -36,7 +40,7 @@ class Version(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
- return 31
+ return 41
# Version
def _patch(self):
@@ -53,8 +57,20 @@ class Version(object):
return True
def VersionStart(builder): builder.StartObject(4)
+def Start(builder):
+ return VersionStart(builder)
def VersionAdd_major(builder, Major): builder.PrependInt32Slot(0, Major, 0)
-def VersionAdd_minor(builder, Minor): builder.PrependInt32Slot(1, Minor, 31)
+def Add_major(builder, Major):
+ return VersionAdd_major(builder, Major)
+def VersionAdd_minor(builder, Minor): builder.PrependInt32Slot(1, Minor, 41)
+def Add_minor(builder, Minor):
+ return VersionAdd_minor(builder, Minor)
def VersionAdd_patch(builder, Patch): builder.PrependInt32Slot(2, Patch, 0)
+def Add_patch(builder, Patch):
+ return VersionAdd_patch(builder, Patch)
def VersionAdd_draft(builder, Draft): builder.PrependBoolSlot(3, Draft, 1)
+def Add_draft(builder, Draft):
+ return VersionAdd_draft(builder, Draft)
def VersionEnd(builder): return builder.EndObject()
+def End(builder):
+ return VersionEnd(builder) \ No newline at end of file
diff --git a/python/tosa/WhileLoopAttribute.py b/python/tosa/WhileLoopAttribute.py
index 1e18bca..1078a07 100644
--- a/python/tosa/WhileLoopAttribute.py
+++ b/python/tosa/WhileLoopAttribute.py
@@ -10,13 +10,17 @@ class WhileLoopAttribute(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsWhileLoopAttribute(cls, buf, offset):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = WhileLoopAttribute()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsWhileLoopAttribute(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def WhileLoopAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
@@ -39,6 +43,14 @@ class WhileLoopAttribute(object):
return None
def WhileLoopAttributeStart(builder): builder.StartObject(2)
+def Start(builder):
+ return WhileLoopAttributeStart(builder)
def WhileLoopAttributeAddCondBranch(builder, condBranch): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(condBranch), 0)
+def AddCondBranch(builder, condBranch):
+ return WhileLoopAttributeAddCondBranch(builder, condBranch)
def WhileLoopAttributeAddBodyBranch(builder, bodyBranch): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(bodyBranch), 0)
+def AddBodyBranch(builder, bodyBranch):
+ return WhileLoopAttributeAddBodyBranch(builder, bodyBranch)
def WhileLoopAttributeEnd(builder): return builder.EndObject()
+def End(builder):
+ return WhileLoopAttributeEnd(builder) \ No newline at end of file
diff --git a/schema/tosa.fbs b/schema/tosa.fbs
index 57440ef..d6d0f22 100644
--- a/schema/tosa.fbs
+++ b/schema/tosa.fbs
@@ -210,12 +210,9 @@ table TileAttribute {
}
table ResizeAttribute {
- output_size: [int32];
- stride: [int32];
- offset: [int32];
- shift: int32;
- stride_fp: [float];
- offset_fp: [float];
+ scale: [int16];
+ offset: [int16];
+ border: [int16];
mode: ResizeMode;
}
@@ -279,7 +276,7 @@ table NegateAttribute {
table Version {
_major: int32 = 0;
- _minor: int32 = 31;
+ _minor: int32 = 41;
_patch: int32 = 0;
_draft: bool = true;
}
diff --git a/third_party/flatbuffers b/third_party/flatbuffers
-Subproject 697147a2e686486424b9d15fc3e1612586a60f9
+Subproject 615616cb5549a34bdf288c04bc1b94bd7a65c39