summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChunseok Lee <chunseok.lee@samsung.com>2020-07-30 11:32:26 +0900
committerChunseok Lee <chunseok.lee@samsung.com>2020-07-30 11:32:26 +0900
commit05e0ec30a632339a8533082476f27bda31ccde16 (patch)
tree5f220ac83084fe133ffb08a6a17e99f9bb36ec1c /tools
parente2ef8438a24f7c56a0744eb579a6e293ee2fbf8e (diff)
downloadnnfw-05e0ec30a632339a8533082476f27bda31ccde16.tar.gz
nnfw-05e0ec30a632339a8533082476f27bda31ccde16.tar.bz2
nnfw-05e0ec30a632339a8533082476f27bda31ccde16.zip
Imported Upstream version 1.7.0upstream/1.7.0
Diffstat (limited to 'tools')
-rwxr-xr-xtools/cross/install_android_ndk.sh (renamed from tools/cross/build_android_ndk.sh)0
-rwxr-xr-xtools/cross/install_rootfs.sh (renamed from tools/cross/build_rootfs.sh)0
-rw-r--r--tools/kbenchmark/CMakeLists.txt2
-rw-r--r--tools/kbenchmark/kernels/acl_cl/CMakeLists.txt2
-rw-r--r--tools/kbenchmark/kernels/acl_neon/CMakeLists.txt2
-rwxr-xr-xtools/kernel_report/kernel_report.py71
-rw-r--r--tools/lcov-to-cobertura-xml/.FORMATDENY0
-rw-r--r--tools/lcov-to-cobertura-xml/README.md5
-rwxr-xr-xtools/lcov-to-cobertura-xml/lcov_cobertura.py414
-rwxr-xr-xtools/nnpackage_tool/gen_golden/gen_golden.py42
-rw-r--r--tools/nnpackage_tool/nnpkg_test/README.md42
-rw-r--r--tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.acl_cl27
-rw-r--r--tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.acl_neon27
-rw-r--r--tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.cpu17
-rw-r--r--tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.srcn5
-rw-r--r--tools/nnpackage_tool/nnpkg_test/list.noarch.interp19
-rwxr-xr-xtools/nnpackage_tool/nnpkg_test/nnpkg_test.sh123
-rw-r--r--tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.md20
-rw-r--r--tools/nnpackage_tool/sth2nnpkgtc/tflite2nnpkgtc.md2
-rw-r--r--tools/nnpackage_tool/tf2tfliteV2/README.md47
-rwxr-xr-xtools/nnpackage_tool/tf2tfliteV2/tf2tfliteV2.py173
-rw-r--r--tools/opencl_tool/CMakeLists.txt2
-rw-r--r--tools/tflitefile_tool/README.md15
-rwxr-xr-xtools/tflitefile_tool/select_operator.py261
-rwxr-xr-xtools/tflitefile_tool/subgraph_printer.py26
-rwxr-xr-xtools/tflitefile_tool/tensor_printer.py6
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/AbsOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ActivationFunctionType.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/AddNOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/AddOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ArgMaxOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ArgMinOptions.py2
-rw-r--r--tools/tflitefile_tool/tflite/BatchMatMulOptions.py52
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/BatchToSpaceNDOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/BidirectionalSequenceLSTMOptions.py17
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/BidirectionalSequenceRNNOptions.py17
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/Buffer.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/BuiltinOperator.py6
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/BuiltinOptions.py6
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/CallOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/CastOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/CombinerType.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ConcatEmbeddingsOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ConcatenationOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/Conv2DOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/CosOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/CustomOptionsFormat.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/CustomQuantization.py2
-rw-r--r--tools/tflitefile_tool/tflite/DensifyOptions.py28
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/DepthToSpaceOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/DepthwiseConv2DOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/DequantizeOptions.py2
-rw-r--r--tools/tflitefile_tool/tflite/DimensionMetadata.py102
-rw-r--r--tools/tflitefile_tool/tflite/DimensionType.py8
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/DivOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/EmbeddingLookupSparseOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/EqualOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ExpOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ExpandDimsOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/FakeQuantOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/FillOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/FloorDivOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/FloorModOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/FullyConnectedOptions.py16
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/FullyConnectedOptionsWeightsFormat.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/GatherNdOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/GatherOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/GreaterEqualOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/GreaterOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/HardSwishOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/IfOptions.py2
-rw-r--r--tools/tflitefile_tool/tflite/Int32Vector.py61
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/L2NormOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LSHProjectionOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LSHProjectionType.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LSTMKernelType.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LSTMOptions.py16
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LeakyReluOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LessEqualOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LessOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LocalResponseNormalizationOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LogSoftmaxOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LogicalAndOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LogicalNotOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/LogicalOrOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/MatrixDiagOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/MatrixSetDiagOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/MaximumMinimumOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/Metadata.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/MirrorPadMode.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/MirrorPadOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/Model.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/MulOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/NegOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/NonMaxSuppressionV4Options.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/NonMaxSuppressionV5Options.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/NotEqualOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/OneHotOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/Operator.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/OperatorCode.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/PackOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/PadOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/PadV2Options.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/Padding.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/Pool2DOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/PowOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/QuantizationDetails.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/QuantizationParameters.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/QuantizeOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/RNNOptions.py16
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/RangeOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/RankOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ReducerOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ReshapeOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ResizeBilinearOptions.py16
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ResizeNearestNeighborOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ReverseSequenceOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ReverseV2Options.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SVDFOptions.py16
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ScatterNdOptions.py2
-rw-r--r--tools/tflitefile_tool/tflite/SegmentSumOptions.py28
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SelectOptions.py2
-rw-r--r--tools/tflitefile_tool/tflite/SelectV2Options.py28
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SequenceRNNOptions.py16
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ShapeOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SkipGramOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SliceOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SoftmaxOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SpaceToBatchNDOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SpaceToDepthOptions.py2
-rw-r--r--tools/tflitefile_tool/tflite/SparseIndexVector.py10
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SparseToDenseOptions.py2
-rw-r--r--tools/tflitefile_tool/tflite/SparsityParameters.py123
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SplitOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SplitVOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SquareOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SquaredDifferenceOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SqueezeOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/StridedSliceOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SubGraph.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/SubOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/Tensor.py53
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/TensorType.py3
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/TileOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/TopKV2Options.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/TransposeConvOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/TransposeOptions.py2
-rw-r--r--tools/tflitefile_tool/tflite/Uint16Vector.py61
-rw-r--r--tools/tflitefile_tool/tflite/Uint8Vector.py61
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/UnidirectionalSequenceLSTMOptions.py17
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/UniqueOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/UnpackOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/WhereOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/WhileOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/ZerosLikeOptions.py2
-rw-r--r--[-rwxr-xr-x]tools/tflitefile_tool/tflite/__init__.py0
-rw-r--r--tools/update_version/update-version50
157 files changed, 1228 insertions, 1159 deletions
diff --git a/tools/cross/build_android_ndk.sh b/tools/cross/install_android_ndk.sh
index e3e86f4b0..e3e86f4b0 100755
--- a/tools/cross/build_android_ndk.sh
+++ b/tools/cross/install_android_ndk.sh
diff --git a/tools/cross/build_rootfs.sh b/tools/cross/install_rootfs.sh
index f6c59b9c5..f6c59b9c5 100755
--- a/tools/cross/build_rootfs.sh
+++ b/tools/cross/install_rootfs.sh
diff --git a/tools/kbenchmark/CMakeLists.txt b/tools/kbenchmark/CMakeLists.txt
index e31a50671..efd508128 100644
--- a/tools/kbenchmark/CMakeLists.txt
+++ b/tools/kbenchmark/CMakeLists.txt
@@ -8,7 +8,7 @@ if(NOT Nonius_FOUND)
return()
endif(NOT Nonius_FOUND)
-nnas_find_package(Boost QUIET)
+nnfw_find_package(Boost REQUIRED program_options system filesystem)
if(NOT Boost_FOUND)
return()
diff --git a/tools/kbenchmark/kernels/acl_cl/CMakeLists.txt b/tools/kbenchmark/kernels/acl_cl/CMakeLists.txt
index 952f8051b..c727905a6 100644
--- a/tools/kbenchmark/kernels/acl_cl/CMakeLists.txt
+++ b/tools/kbenchmark/kernels/acl_cl/CMakeLists.txt
@@ -1,4 +1,4 @@
-nnas_find_package(ARMCompute QUIET)
+nnfw_find_package(ARMCompute QUIET)
if(NOT ARMCompute_FOUND)
return()
endif(NOT ARMCompute_FOUND)
diff --git a/tools/kbenchmark/kernels/acl_neon/CMakeLists.txt b/tools/kbenchmark/kernels/acl_neon/CMakeLists.txt
index a9daac997..54afdab09 100644
--- a/tools/kbenchmark/kernels/acl_neon/CMakeLists.txt
+++ b/tools/kbenchmark/kernels/acl_neon/CMakeLists.txt
@@ -1,4 +1,4 @@
-nnas_find_package(ARMCompute QUIET)
+nnfw_find_package(ARMCompute QUIET)
if(NOT ARMCompute_FOUND)
return()
endif(NOT ARMCompute_FOUND)
diff --git a/tools/kernel_report/kernel_report.py b/tools/kernel_report/kernel_report.py
index 0be5b82d5..b8a601eec 100755
--- a/tools/kernel_report/kernel_report.py
+++ b/tools/kernel_report/kernel_report.py
@@ -19,12 +19,11 @@ import argparse
class Backend:
- def __init__(self):
+ def __init__(self, backendList):
self.backends = {}
- self.backends["acl_cl"] = False
- self.backends["acl_neon"] = False
- self.backends["cpu"] = False
- self.backends["srcn"] = False
+
+ for backend in backendList:
+ self.backends[backend] = False
class KernelReporter(object):
@@ -34,14 +33,17 @@ class KernelReporter(object):
self.onertBase = os.getcwd() + '/' + args.base
else:
self.onertBase = args.base
+ if args.md5:
+ self.printMD5 = True
+ else:
+ self.printMD5 = False
+ self.backendList = args.backends.split(',')
self.opListFile = "core/include/ir/Operations.lst"
self.operations = []
self.kernelGeneratorFile = "KernelGenerator.h"
self.kernelMap = {}
def parseOpList(self):
- #buf = open(self.onertBase + '/' + self.opListFile, "r")
-
# Parsing line and get op list
skipLine = False
for line in open(self.onertBase + '/' + self.opListFile, "r"):
@@ -74,11 +76,9 @@ class KernelReporter(object):
def generateKernelMap(self):
for op in self.operations:
- self.kernelMap[op] = Backend()
+ self.kernelMap[op] = Backend(self.backendList)
- backendLists = ["acl_cl", "acl_neon", "cpu", "srcn"]
-
- for backend in backendLists:
+ for backend in self.backendList:
buf = open(
self.onertBase + '/backend/' + backend + '/' + self.kernelGeneratorFile,
"r")
@@ -101,18 +101,19 @@ class KernelReporter(object):
def printResult(self):
print()
- backendLists = ["acl_cl", "acl_neon", "cpu", "srcn"]
line = ""
- for backend in backendLists:
+ for backend in self.backendList:
line = line + "{0:^9}".format(backend)
print('{0:30}{1}'.format("", line))
- counts = [0, 0, 0, 0]
+ counts = []
+ for i in range(0, len(self.backendList), 1):
+ counts.append(0)
for op in self.operations:
line = ""
- for i in range(0, 4, 1):
- support = self.kernelMap[op].backends[backendLists[i]]
+ for i in range(0, len(self.backendList), 1):
+ support = self.kernelMap[op].backends[self.backendList[i]]
if support:
line = line + "{0:^9}".format("O")
counts[i] += 1
@@ -127,19 +128,23 @@ class KernelReporter(object):
def printMDFormat(self):
print()
- backendLists = ["acl_cl", "acl_neon", "cpu", "srcn"]
- line = ""
- for backend in backendLists:
+ line = "-"
+ for backend in self.backendList:
line = line + "|" + backend
- print("|" + line)
- print("-|-|-|-|-")
+ print(line)
+ line = ""
+ for i in range(0, len(self.backendList), 1):
+ line = line + "-|"
+ print(line + "-")
- counts = [0, 0, 0, 0]
+ counts = []
+ for i in range(0, len(self.backendList), 1):
+ counts.append(0)
for op in self.operations:
line = ""
- for i in range(0, 4, 1):
- support = self.kernelMap[op].backends[backendLists[i]]
+ for i in range(0, len(self.backendList), 1):
+ support = self.kernelMap[op].backends[self.backendList[i]]
if support:
line = line + "|" + "O"
counts[i] += 1
@@ -148,22 +153,34 @@ class KernelReporter(object):
print(op + line)
line = ""
+ for i in range(0, len(self.backendList), 1):
+ line = line + "-|"
+ print(line + "-")
+
+ line = ""
for count in counts:
line = line + "|" + str(count)
- print("-|-|-|-|-")
print("TOTAL COUNT" + line)
def run(self):
self.parseOpList()
self.generateKernelMap()
- self.printResult()
- self.printMDFormat()
+ if self.printMD5:
+ self.printMDFormat()
+ else:
+ self.printResult()
if __name__ == '__main__':
arg_parser = argparse.ArgumentParser()
+ arg_parser.add_argument(
+ "--backends",
+ type=str,
+ default='cpu,acl_cl,acl_neon',
+ help="backend list to report (use comma)")
+ arg_parser.add_argument("--md5", action='store_true', help="Print for md5")
arg_parser.add_argument("base", type=str, help="onert base directory")
args = arg_parser.parse_args()
diff --git a/tools/lcov-to-cobertura-xml/.FORMATDENY b/tools/lcov-to-cobertura-xml/.FORMATDENY
deleted file mode 100644
index e69de29bb..000000000
--- a/tools/lcov-to-cobertura-xml/.FORMATDENY
+++ /dev/null
diff --git a/tools/lcov-to-cobertura-xml/README.md b/tools/lcov-to-cobertura-xml/README.md
deleted file mode 100644
index 2fc4cff42..000000000
--- a/tools/lcov-to-cobertura-xml/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# lcov to cobertura XML converter
-
-lcov to cobertura XML converter is imported from
-
-https://github.com/eriwen/lcov-to-cobertura-xml
diff --git a/tools/lcov-to-cobertura-xml/lcov_cobertura.py b/tools/lcov-to-cobertura-xml/lcov_cobertura.py
deleted file mode 100755
index 7aae6d115..000000000
--- a/tools/lcov-to-cobertura-xml/lcov_cobertura.py
+++ /dev/null
@@ -1,414 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2011-2012 Eric Wendelin
-#
-# This is free software, licensed under the Apache License, Version 2.0,
-# available in the accompanying LICENSE.txt file.
-
-"""
-Converts lcov line coverage output to Cobertura-compatible XML for CI
-"""
-
-import re
-import sys
-import os
-import time
-import subprocess
-from xml.dom import minidom
-from optparse import OptionParser
-
-from distutils.spawn import find_executable
-
-CPPFILT = "c++filt"
-HAVE_CPPFILT = False
-
-if find_executable(CPPFILT) is not None:
- HAVE_CPPFILT = True
-
-VERSION = '1.6'
-__all__ = ['LcovCobertura']
-
-
-class Demangler(object):
- def __init__(self):
- self.pipe = subprocess.Popen(
- CPPFILT, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
-
- def demangle(self, name):
- self.pipe.stdin.write(name + "\n")
- return self.pipe.stdout.readline().rstrip()
-
-
-class LcovCobertura(object):
- """
- Converts code coverage report files in lcov format to Cobertura's XML
- report format so that CI servers like Jenkins can aggregate results and
- determine build stability etc.
-
- >>> from lcov_cobertura import LcovCobertura
- >>> LCOV_INPUT = 'your lcov input'
- >>> converter = LcovCobertura(LCOV_INPUT)
- >>> cobertura_xml = converter.convert()
- >>> print(cobertura_xml)
- """
-
- def __init__(self, lcov_data, base_dir='.', excludes=None, demangle=False):
- """
- Create a new :class:`LcovCobertura` object using the given `lcov_data`
- and `options`.
-
- :param lcov_data: Path to LCOV data file
- :type lcov_data: string
- :param base_dir: Path upon which to base all sources
- :type base_dir: string
- :param excludes: list of regexes to packages as excluded
- :type excludes: [string]
- :param demangle: whether to demangle function names using c++filt
- :type demangle: bool
- """
-
- if not excludes:
- excludes = []
- self.lcov_data = lcov_data
- self.base_dir = base_dir
- self.excludes = excludes
- if demangle:
- demangler = Demangler()
- self.format = demangler.demangle
- else:
- self.format = lambda x: x
-
- def convert(self):
- """
- Convert lcov file to cobertura XML using options from this instance.
- """
- coverage_data = self.parse()
- return self.generate_cobertura_xml(coverage_data)
-
- def parse(self):
- """
- Generate a data structure representing it that can be serialized in any
- logical format.
- """
-
- coverage_data = {
- 'packages': {},
- 'summary': {'lines-total': 0, 'lines-covered': 0,
- 'branches-total': 0, 'branches-covered': 0},
- 'timestamp': str(int(time.time()))
- }
- package = None
- current_file = None
- file_lines_total = 0
- file_lines_covered = 0
- file_lines = {}
- file_methods = {}
- file_branches_total = 0
- file_branches_covered = 0
-
- for line in self.lcov_data.split('\n'):
- if line.strip() == 'end_of_record':
- if current_file is not None:
- package_dict = coverage_data['packages'][package]
- package_dict['lines-total'] += file_lines_total
- package_dict['lines-covered'] += file_lines_covered
- package_dict['branches-total'] += file_branches_total
- package_dict['branches-covered'] += file_branches_covered
- file_dict = package_dict['classes'][current_file]
- file_dict['lines-total'] = file_lines_total
- file_dict['lines-covered'] = file_lines_covered
- file_dict['lines'] = dict(file_lines)
- file_dict['methods'] = dict(file_methods)
- file_dict['branches-total'] = file_branches_total
- file_dict['branches-covered'] = file_branches_covered
- coverage_data['summary']['lines-total'] += file_lines_total
- coverage_data['summary']['lines-covered'] += file_lines_covered
- coverage_data['summary']['branches-total'] += file_branches_total
- coverage_data['summary']['branches-covered'] += file_branches_covered
-
- line_parts = line.split(':', 1)
- input_type = line_parts[0]
-
- if input_type == 'SF':
- # Get file name
- file_name = line_parts[-1].strip()
- relative_file_name = os.path.relpath(file_name, self.base_dir)
- package = '.'.join(relative_file_name.split(os.path.sep)[0:-1])
- class_name = '.'.join(relative_file_name.split(os.path.sep))
- if package not in coverage_data['packages']:
- coverage_data['packages'][package] = {
- 'classes': {}, 'lines-total': 0, 'lines-covered': 0,
- 'branches-total': 0, 'branches-covered': 0
- }
- coverage_data['packages'][package]['classes'][
- relative_file_name] = {
- 'name': class_name, 'lines': {}, 'lines-total': 0,
- 'lines-covered': 0, 'branches-total': 0,
- 'branches-covered': 0
- }
- package = package
- current_file = relative_file_name
- file_lines_total = 0
- file_lines_covered = 0
- file_lines.clear()
- file_methods.clear()
- file_branches_total = 0
- file_branches_covered = 0
- elif input_type == 'DA':
- # DA:2,0
- (line_number, line_hits) = line_parts[-1].strip().split(',')
- line_number = int(line_number)
- if line_number not in file_lines:
- file_lines[line_number] = {
- 'branch': 'false', 'branches-total': 0,
- 'branches-covered': 0
- }
- file_lines[line_number]['hits'] = line_hits
- # Increment lines total/covered for class and package
- try:
- if int(line_hits) > 0:
- file_lines_covered += 1
- except:
- pass
- file_lines_total += 1
- elif input_type == 'BRDA':
- # BRDA:1,1,2,0
- (line_number, block_number, branch_number, branch_hits) = line_parts[-1].strip().split(',')
- line_number = int(line_number)
- if line_number not in file_lines:
- file_lines[line_number] = {
- 'branch': 'true', 'branches-total': 0,
- 'branches-covered': 0, 'hits': 0
- }
- file_lines[line_number]['branch'] = 'true'
- file_lines[line_number]['branches-total'] += 1
- file_branches_total += 1
- if branch_hits != '-' and int(branch_hits) > 0:
- file_lines[line_number]['branches-covered'] += 1
- file_branches_covered += 1
- elif input_type == 'BRF':
- file_branches_total = int(line_parts[1])
- elif input_type == 'BRH':
- file_branches_covered = int(line_parts[1])
- elif input_type == 'FN':
- # FN:5,(anonymous_1)
- function_line, function_name = line_parts[-1].strip().split(',')
- file_methods[function_name] = [function_line, '0']
- elif input_type == 'FNDA':
- # FNDA:0,(anonymous_1)
- (function_hits, function_name) = line_parts[-1].strip().split(',')
- if function_name not in file_methods:
- file_methods[function_name] = ['0', '0']
- file_methods[function_name][-1] = function_hits
-
- # Exclude packages
- excluded = [x for x in coverage_data['packages'] for e in self.excludes
- if re.match(e, x)]
- for package in excluded:
- del coverage_data['packages'][package]
-
- # Compute line coverage rates
- for package_data in list(coverage_data['packages'].values()):
- package_data['line-rate'] = self._percent(
- package_data['lines-total'],
- package_data['lines-covered'])
- package_data['branch-rate'] = self._percent(
- package_data['branches-total'],
- package_data['branches-covered'])
-
- return coverage_data
-
- def generate_cobertura_xml(self, coverage_data):
- """
- Given parsed coverage data, return a String cobertura XML representation.
-
- :param coverage_data: Nested dict representing coverage information.
- :type coverage_data: dict
- """
-
- dom_impl = minidom.getDOMImplementation()
- doctype = dom_impl.createDocumentType("coverage", None,
- "http://cobertura.sourceforge.net/xml/coverage-04.dtd")
- document = dom_impl.createDocument(None, "coverage", doctype)
- root = document.documentElement
- summary = coverage_data['summary']
- self._attrs(root, {
- 'branch-rate': self._percent(summary['branches-total'],
- summary['branches-covered']),
- 'branches-covered': str(summary['branches-covered']),
- 'branches-valid': str(summary['branches-total']),
- 'complexity': '0',
- 'line-rate': self._percent(summary['lines-total'],
- summary['lines-covered']),
- 'lines-covered': str(summary['lines-covered']),
- 'lines-valid': str(summary['lines-total']),
- 'timestamp': coverage_data['timestamp'],
- 'version': '2.0.3'
- })
-
- sources = self._el(document, 'sources', {})
- source = self._el(document, 'source', {})
- source.appendChild(document.createTextNode(self.base_dir))
- sources.appendChild(source)
-
- root.appendChild(sources)
-
- packages_el = self._el(document, 'packages', {})
-
- packages = coverage_data['packages']
- for package_name, package_data in list(packages.items()):
- package_el = self._el(document, 'package', {
- 'line-rate': package_data['line-rate'],
- 'branch-rate': package_data['branch-rate'],
- 'name': package_name,
- 'complexity': '0',
- })
- classes_el = self._el(document, 'classes', {})
- for class_name, class_data in list(package_data['classes'].items()):
- class_el = self._el(document, 'class', {
- 'branch-rate': self._percent(class_data['branches-total'],
- class_data['branches-covered']),
- 'complexity': '0',
- 'filename': class_name,
- 'line-rate': self._percent(class_data['lines-total'],
- class_data['lines-covered']),
- 'name': class_data['name']
- })
-
- # Process methods
- methods_el = self._el(document, 'methods', {})
- for method_name, (line, hits) in list(class_data['methods'].items()):
- method_el = self._el(document, 'method', {
- 'name': self.format(method_name),
- 'signature': '',
- 'line-rate': '1.0' if int(hits) > 0 else '0.0',
- 'branch-rate': '1.0' if int(hits) > 0 else '0.0',
- })
- method_lines_el = self._el(document, 'lines', {})
- method_line_el = self._el(document, 'line', {
- 'hits': hits,
- 'number': line,
- 'branch': 'false',
- })
- method_lines_el.appendChild(method_line_el)
- method_el.appendChild(method_lines_el)
- methods_el.appendChild(method_el)
-
- # Process lines
- lines_el = self._el(document, 'lines', {})
- lines = list(class_data['lines'].keys())
- lines.sort()
- for line_number in lines:
- line_el = self._el(document, 'line', {
- 'branch': class_data['lines'][line_number]['branch'],
- 'hits': str(class_data['lines'][line_number]['hits']),
- 'number': str(line_number)
- })
- if class_data['lines'][line_number]['branch'] == 'true':
- total = int(class_data['lines'][line_number]['branches-total'])
- covered = int(class_data['lines'][line_number]['branches-covered'])
- percentage = int((covered * 100.0) / total)
- line_el.setAttribute('condition-coverage',
- '{0}% ({1}/{2})'.format(
- percentage, covered, total))
- lines_el.appendChild(line_el)
-
- class_el.appendChild(methods_el)
- class_el.appendChild(lines_el)
- classes_el.appendChild(class_el)
- package_el.appendChild(classes_el)
- packages_el.appendChild(package_el)
- root.appendChild(packages_el)
-
- return document.toprettyxml()
-
- def _el(self, document, name, attrs):
- """
- Create an element within document with given name and attributes.
-
- :param document: Document element
- :type document: Document
- :param name: Element name
- :type name: string
- :param attrs: Attributes for element
- :type attrs: dict
- """
- return self._attrs(document.createElement(name), attrs)
-
- def _attrs(self, element, attrs):
- """
- Set attributes on given element.
-
- :param element: DOM Element
- :type element: Element
- :param attrs: Attributes for element
- :type attrs: dict
- """
- for attr, val in list(attrs.items()):
- element.setAttribute(attr, val)
- return element
-
- def _percent(self, lines_total, lines_covered):
- """
- Get the percentage of lines covered in the total, with formatting.
-
- :param lines_total: Total number of lines in given module
- :type lines_total: number
- :param lines_covered: Number of lines covered by tests in module
- :type lines_covered: number
- """
-
- if lines_total == 0:
- return '0.0'
- return str(float(float(lines_covered) / float(lines_total)))
-
-
-def main(argv=None):
- """
- Converts LCOV coverage data to Cobertura-compatible XML for reporting.
-
- Usage:
- lcov_cobertura.py lcov-file.dat
- lcov_cobertura.py lcov-file.dat -b src/dir -e test.lib -o path/out.xml
-
- By default, XML output will be written to ./coverage.xml
- """
- if argv is None:
- argv = sys.argv
- parser = OptionParser()
- parser.usage = ('lcov_cobertura.py lcov-file.dat [-b source/dir] '
- '[-e <exclude packages regex>] [-o output.xml] [-d]')
- parser.description = 'Converts lcov output to cobertura-compatible XML'
- parser.add_option('-b', '--base-dir', action='store',
- help='Directory where source files are located',
- dest='base_dir', default='.')
- parser.add_option('-e', '--excludes',
- help='Comma-separated list of regexes of packages to exclude',
- action='append', dest='excludes', default=[])
- parser.add_option('-o', '--output',
- help='Path to store cobertura xml file',
- action='store', dest='output', default='coverage.xml')
- parser.add_option('-d', '--demangle',
- help='Demangle C++ function names using %s' % CPPFILT,
- action='store_true', dest='demangle', default=False)
- (options, args) = parser.parse_args(args=argv)
-
- if options.demangle and not HAVE_CPPFILT:
- raise RuntimeError("C++ filter executable (%s) not found!" % CPPFILT)
-
- if len(args) != 2:
- print(main.__doc__)
- sys.exit(1)
-
- try:
- with open(args[1], 'r') as lcov_file:
- lcov_data = lcov_file.read()
- lcov_cobertura = LcovCobertura(lcov_data, options.base_dir, options.excludes, options.demangle)
- cobertura_xml = lcov_cobertura.convert()
- with open(options.output, mode='wt') as output_file:
- output_file.write(cobertura_xml)
- except IOError:
- sys.stderr.write("Unable to convert %s to Cobertura XML" % args[1])
-
-if __name__ == '__main__':
- main()
diff --git a/tools/nnpackage_tool/gen_golden/gen_golden.py b/tools/nnpackage_tool/gen_golden/gen_golden.py
index 4e8e0cba5..125a69cac 100755
--- a/tools/nnpackage_tool/gen_golden/gen_golden.py
+++ b/tools/nnpackage_tool/gen_golden/gen_golden.py
@@ -85,10 +85,23 @@ if __name__ == '__main__':
output_dtypes = [graph.get_tensor_by_name(name).dtype for name in output_names]
# gen random input values
- input_values = [
- np.random.random_sample(size=graph.get_tensor_by_name(name).shape)
- for name in input_names
- ]
+ for idx in range(len(input_names)):
+ this_shape = graph.get_tensor_by_name(input_names[idx]).shape
+ this_dtype = input_dtypes[idx]
+ if this_dtype == tf.uint8:
+ input_values.append(
+ np.random.randint(0, 255, this_shape).astype(np.uint8))
+ elif this_dtype == tf.float32:
+ input_values.append(
+ np.random.random_sample(this_shape).astype(np.float32))
+ elif this_dtype == tf.bool:
+ # generate random integer from [0, 2)
+ input_values.append(
+ np.random.randint(2, size=this_shape).astype(np.bool_))
+ elif this_dtype == tf.int32:
+ input_values.append(np.random.randint(0, 99, this_shape).astype(np.int32))
+ elif this_dtype == tf.int64:
+ input_values.append(np.random.randint(0, 99, this_shape).astype(np.int64))
# get output values by running
config = tf.compat.v1.ConfigProto()
@@ -120,17 +133,18 @@ if __name__ == '__main__':
this_dtype = input_details[idx]['dtype']
if this_dtype == np.uint8:
input_values.append(
- np.array(np.random.randint(0, 255, this_shape, this_dtype)))
+ np.random.randint(0, 255, this_shape).astype(np.uint8))
elif this_dtype == np.float32:
input_values.append(
- np.array(np.random.random_sample(this_shape), this_dtype))
+ np.random.random_sample(this_shape).astype(np.float32))
elif this_dtype == np.bool_:
# generate random integer from [0, 2)
input_values.append(
- np.array(np.random.randint(2, size=this_shape), this_dtype))
+ np.random.randint(2, size=this_shape).astype(np.bool_))
elif this_dtype == np.int32:
- input_values.append(
- np.array(np.random.randint(-(2**15), 2**15, this_shape, this_dtype)))
+ input_values.append(np.random.randint(0, 99, this_shape).astype(np.int32))
+ elif this_dtype == np.int64:
+ input_values.append(np.random.randint(0, 99, this_shape).astype(np.int64))
interpreter.set_tensor(input_details[idx]['index'], input_values[idx])
# get output values by running
@@ -144,8 +158,14 @@ if __name__ == '__main__':
# dump input and output in h5
import h5py
- supported_dtypes = ("float32", "uint8", "bool", "int32")
- h5dtypes = {"float32": ">f4", "uint8": "u1", "bool": "u1", "int32": "int32"}
+ supported_dtypes = ("float32", "uint8", "bool", "int32", "int64")
+ h5dtypes = {
+ "float32": ">f4",
+ "uint8": "u1",
+ "bool": "u1",
+ "int32": "int32",
+ "int64": "int64"
+ }
with h5py.File(out_dir + "input.h5", 'w') as hf:
name_grp = hf.create_group("name")
val_grp = hf.create_group("value")
diff --git a/tools/nnpackage_tool/nnpkg_test/README.md b/tools/nnpackage_tool/nnpkg_test/README.md
deleted file mode 100644
index 916877a3d..000000000
--- a/tools/nnpackage_tool/nnpkg_test/README.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# nnpkg_test
-
-`nnpkg_test` is a tool to run an nnpackage testcase.
-
-`nnpackage testcase` is an nnpackage with additional data:
-
-- input.h5 (input data)
-- expected.h5 (expected outpute data)
-
-`nnpkg_test` uses `nnpackage_run` internally to run `nnpackage`.
-
-Then, it compares through `difftool` (either `i5diff` or `h5diff`).
-
-`nnpkg_test` returns `0` on success, `non-zero` otherwise.
-
-## Usage
-
-```
-$ tools/nnpackage_tool/nnpkg_test/nnpkg_test.sh -h
-Usage: nnpkg_test.sh [options] nnpackage_test
-Run an nnpackage testcase
-
-Returns
- 0 success
- non-zero failure
-
-Options:
- -h show this help
- -i set input directory (default=.)
- -o set output directory (default=.)
- -d delete dumped file on failure.
- (dumped file are always deleted on success) (default=0)
-
-Environment variables:
- nnpackage_run path to nnpackage_run (default=Product/out/bin/nnpackage_run)
- difftool path to i5diff or h5diff (default=h5diff)
-
-Examples:
- nnpkg_test.sh Add_000 => run ./Add_000 and check output
- nnpkg_test.sh -i nnpkg-tcs Add_000 => run nnpkg-tcs/Add_000 and check output
-
-```
diff --git a/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.acl_cl b/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.acl_cl
deleted file mode 100644
index 866f734e0..000000000
--- a/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.acl_cl
+++ /dev/null
@@ -1,27 +0,0 @@
-NET_000[0-5,7-9]
-NET_001[0,2-9]
-NET_002[0-2,4-9]
-NET_003[0-9]
-NET_004[0-9]
-UNIT_Add_*
-UNIT_AvgPool_*
-UNIT_BiasAdd_*
-UNIT_ConcatV2_*
-UNIT_Conv2D_*
-UNIT_Conv2DBackpropInput_*
-UNIT_DepthwiseConv2dNative_*
-UNIT_MaxPool_*
-UNIT_Mean_*
-UNIT_Mul_*
-UNIT_Pad_*
-UNIT_RealDiv_*
-UNIT_Relu6_*
-UNIT_Relu_*
-UNIT_Reshape_*
-UNIT_Rsqrt_*
-UNIT_Softmax_*
-UNIT_Sqrt_*
-UNIT_SquaredDifference_*
-UNIT_Squeeze_*
-UNIT_Sub_*
-UNIT_Tanh_000
diff --git a/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.acl_neon b/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.acl_neon
deleted file mode 100644
index 7e2371b26..000000000
--- a/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.acl_neon
+++ /dev/null
@@ -1,27 +0,0 @@
-NET_000[0-5,7-9]
-NET_001[0-9]
-NET_002[0-2,4-9]
-NET_003[0-9]
-NET_004[0-9]
-UNIT_Add_*
-UNIT_AvgPool_*
-UNIT_BiasAdd_*
-UNIT_ConcatV2_*
-UNIT_Conv2D_*
-UNIT_Conv2DBackpropInput_*
-UNIT_DepthwiseConv2dNative_*
-UNIT_MaxPool_*
-UNIT_Mean_*
-UNIT_Mul_*
-UNIT_Pad_*
-UNIT_RealDiv_*
-UNIT_Relu6_*
-UNIT_Relu_*
-UNIT_Reshape_*
-UNIT_Rsqrt_*
-UNIT_Softmax_*
-UNIT_Sqrt_*
-UNIT_SquaredDifference_*
-UNIT_Squeeze_*
-UNIT_Sub_*
-UNIT_Tanh_000
diff --git a/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.cpu b/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.cpu
deleted file mode 100644
index cd765a465..000000000
--- a/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.cpu
+++ /dev/null
@@ -1,17 +0,0 @@
-NET_000[0-4,6-9]
-NET_001[0-3,6-9]
-NET_002[0-2,4-7,9]
-NET_003[0-9]
-NET_004[0-9]
-UNIT_Add_*
-UNIT_AvgPool_*
-UNIT_ConcatV2_*
-UNIT_Conv2D_*
-UNIT_DepthwiseConv2dNative_*
-UNIT_MaxPool_*
-UNIT_Mul_*
-UNIT_Pad_*
-UNIT_Reshape_*
-UNIT_Softmax_*
-UNIT_Squeeze_*
-UNIT_Sub_*
diff --git a/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.srcn b/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.srcn
deleted file mode 100644
index a893d59ae..000000000
--- a/tools/nnpackage_tool/nnpkg_test/list.armv7l-linux.srcn
+++ /dev/null
@@ -1,5 +0,0 @@
-NET_000[1,3,7-9]
-NET_001[6,9]
-NET_002[2,8]
-UNIT_Conv2D_*
-UNIT_Conv2DBackpropInput_*
diff --git a/tools/nnpackage_tool/nnpkg_test/list.noarch.interp b/tools/nnpackage_tool/nnpkg_test/list.noarch.interp
deleted file mode 100644
index cb865da84..000000000
--- a/tools/nnpackage_tool/nnpkg_test/list.noarch.interp
+++ /dev/null
@@ -1,19 +0,0 @@
-NET_000[0-9]
-NET_001[0-4,6-9]
-NET_002[0-2,4-9]
-NET_003[0-9]
-NET_004[0-9]
-UNIT_Add_*
-UNIT_AvgPool_*
-UNIT_BiasAdd_*
-UNIT_ConcatV2_*
-UNIT_Conv2D_*
-UNIT_Conv2DBackpropInput_*
-UNIT_DepthwiseConv2dNative_*
-UNIT_MaxPool_*
-UNIT_Mul_*
-UNIT_Pad_*
-UNIT_Reshape_*
-UNIT_Softmax_*
-UNIT_Squeeze_*
-UNIT_Sub_*
diff --git a/tools/nnpackage_tool/nnpkg_test/nnpkg_test.sh b/tools/nnpackage_tool/nnpkg_test/nnpkg_test.sh
deleted file mode 100755
index 00b7a0e40..000000000
--- a/tools/nnpackage_tool/nnpkg_test/nnpkg_test.sh
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/bash
-
-set -u
-
-command_exists() {
- command -v "$@" > /dev/null 2>&1
-}
-
-progname=$(basename "${BASH_SOURCE[0]}")
-indir="."
-outdir="."
-nnpkg_run=${nnpkg_run:-"Product/out/bin/nnpackage_run"}
-difftool=${difftool:-"h5diff"}
-delete_dumped_on_failure=0
-
-usage() {
- echo "Usage: $progname [options] nnpackage_test"
- echo "Run an nnpackage testcase"
- echo ""
- echo "Returns"
- echo " 0 success"
- echo " non-zero failure"
- echo ""
- echo "Options:"
- echo " -h show this help"
- echo " -i set input directory (default=$indir)"
- echo " -o set output directory (default=$outdir)"
- echo " -d delete dumped file on failure."
- echo " (dumped file are always deleted on success) (default=$delete_dumped_on_failure)"
- echo ""
- echo "Environment variables:"
- echo " nnpackage_run path to nnpackage_run (default=Product/out/bin/nnpackage_run)"
- echo " difftool path to i5diff or h5diff (default=h5diff)"
- echo ""
- echo "Examples:"
- echo " $progname Add_000 => run $indir/Add_000 and check output"
- echo " $progname -i nnpkg-tcs Add_000 => run nnpkg-tcs/Add_000 and check output"
- exit 1
-}
-
-if [ $# -eq 0 ]; then
- echo "For help, type $progname -h"
- exit 1
-fi
-
-while getopts "hdi:o:" OPTION; do
-case "${OPTION}" in
- h) usage;;
- d) delete_dumped_on_failure=1;;
- i) indir=$OPTARG;;
- o) outdir=$OPTARG;;
- ?) exit 1;;
-esac
-done
-
-shift $((OPTIND-1))
-
-if [ $# -ne 1 ]; then
- echo "error: wrong argument (no argument or too many arguments)."
- echo "For help, type $progname -h"
- exit 1
-fi
-
-if [ ! -e Product ]; then
- echo "error: please make sure to run this script in nnfw home."
- exit 1
-fi
-
-tcname=$(basename "$1")
-nnpkg="$indir/$tcname"
-
-# run
-
-if [ ! -e $nnpkg ]; then
- echo "error: nnpackage "$nnpkg" does not exist."
- exit 1
-fi
-
-if ! command_exists $nnpkg_run; then
- echo "error: runner "$nnpkg_run" does not exist."
- exit 1
-fi
-
-dumped="$outdir/$tcname".out.h5
-
-echo -n "[ Run ] $nnpkg "
-
-if $nnpkg_run \
---nnpackage "$nnpkg" \
---load "$nnpkg/metadata/tc/input.h5" \
---dump "$dumped" >& /dev/null > "$dumped.log" 2>&1 ; then
- echo -e "\tPass"
- rm "$dumped.log"
-else
- echo -e "\tFail"
- echo ""
- cat "$dumped.log"
- echo ""
- rm "$dumped.log"
- exit 2
-fi
-
-# diff
-
-if ! command_exists $difftool; then
- echo "error: difftool "$difftool" does not exist."
- exit 1
-fi
-
-expected="$nnpkg/metadata/tc/expected.h5"
-
-echo -n "[Compare] $nnpkg "
-
-if $difftool -d 0.001 -v "$dumped" "$expected" /value >& "$dumped.log"; then
- echo -e "\tPass"
- rm "$dumped" "$dumped.log"
-else
- echo -e "\tFail"
- [ $delete_dumped_on_failure ] && rm "$dumped"
- cat "$dumped.log"
- rm "$dumped.log"
- exit 3
-fi
diff --git a/tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.md b/tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.md
index 9cf6ab141..df90d0aa1 100644
--- a/tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.md
+++ b/tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.md
@@ -37,16 +37,16 @@ Environment variables:
## example
```
# @ host
-$ tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.sh 03_2k.pb img_placeholder conv2d_transpose
+$ tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.sh test_model.pb img_placeholder conv2d_transpose
# then, nnpkg is generated in {basename}.{outputname}
# it contains all of pb, tflite, circle, and golden data.
-$ tree 03_2k.conv2d_transpose
-03_2k.conv2d_transpose
-├── 03_2k.conv2d_transpose.circle
-├── 03_2k.conv2d_transpose.pb
-├── 03_2k.conv2d_transpose.tflite
+$ tree test_model.conv2d_transpose
+test_model.conv2d_transpose
+├── test_model.conv2d_transpose.circle
+├── test_model.conv2d_transpose.pb
+├── test_model.conv2d_transpose.tflite
└── metadata
├── MANIFEST
└── tc
@@ -54,8 +54,8 @@ $ tree 03_2k.conv2d_transpose
└── input.h5
# @ target
-$ OP_BACKEND_ALLOPS=srcn \
-tools/nnpackage_tool/nnpkg_test/nnpkg_test.sh 03_2k.conv2d_transpose
-[ Run ] ./03_2k.out Pass
-[Compare] ./03_2k.out Pass
+$ OP_BACKEND_ALLOPS=cpu \
+tests/scripts/nnpkg_test.sh test_model.conv2d_transpose
+[ Run ] ./test_model.out Pass
+[Compare] ./test_model.out Pass
```
diff --git a/tools/nnpackage_tool/sth2nnpkgtc/tflite2nnpkgtc.md b/tools/nnpackage_tool/sth2nnpkgtc/tflite2nnpkgtc.md
index 582dcd4c1..dab6ba4d7 100644
--- a/tools/nnpackage_tool/sth2nnpkgtc/tflite2nnpkgtc.md
+++ b/tools/nnpackage_tool/sth2nnpkgtc/tflite2nnpkgtc.md
@@ -42,5 +42,5 @@ nnpkg-tcs/cast
# @ target
# run nnpkg with nnpackage_run and compare with h5diff
-$ tools/nnpackage_tool/nnpkg_test/nnpkg_test.sh -i nnpkg-tcs cast
+$ tests/scripts/nnpkg_test.sh -i nnpkg-tcs cast
```
diff --git a/tools/nnpackage_tool/tf2tfliteV2/README.md b/tools/nnpackage_tool/tf2tfliteV2/README.md
deleted file mode 100644
index 836740a5c..000000000
--- a/tools/nnpackage_tool/tf2tfliteV2/README.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# tf2tfliteV2
-
-_tf2tfliteV2_ is a TensorFlow to TensorFlow Lite model Converter.
-
-## Where does V2 come from?
-Even though we alreay have _tf2tflite_, we cannot cover all opeartors in TensorFlow. To expand coverage, we introduce _tf2tfliteV2_ which uses `TensorFlow Lite Converter`(by Google) internally.
-
-## Prerequisite
-- Frozen graph from TensorFlow 1.13.1
-- Desired version of TensorFlow(You can use python virtualenv, docker, etc.)
-
-## Example
-```
-python tf2tfliteV2.py \
-> --v1 \
-> --input_path=frozen_graph.pb \
-> --output_path=converted.tflite \
-> --input_arrays=model_inputs \
-> --output_arrays=model_outputs
-
-```
-```
-python tf2tfliteV2.py \
-> --v2 \
-> --input_path=frozen_graph.pb \
-> --output_path=converted.tflite \
-> --input_arrays=model_inputs \
-> --output_arrays=model_outputs
-```
-
-## optional argument
-```
- -h, --help show this help message and exit
- --v1 Use TensorFlow Lite Converter 1.x
- --v2 Use TensorFlow Lite Converter 2.x
- --input_path INPUT_PATH
- Full filepath of the input file.
- --output_path OUTPUT_PATH
- Full filepath of the output file.
- --input_arrays INPUT_ARRAYS
- Names of the input arrays, comma-separated.
- --input_shapes INPUT_SHAPES
- Shapes corresponding to --input_arrays, colon-
- separated.
- --output_arrays OUTPUT_ARRAYS
- Names of the output arrays, comma-separated.
-```
diff --git a/tools/nnpackage_tool/tf2tfliteV2/tf2tfliteV2.py b/tools/nnpackage_tool/tf2tfliteV2/tf2tfliteV2.py
deleted file mode 100755
index ebd5a3afa..000000000
--- a/tools/nnpackage_tool/tf2tfliteV2/tf2tfliteV2.py
+++ /dev/null
@@ -1,173 +0,0 @@
-# Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
-# Copyright (C) 2018 The TensorFlow Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import tensorflow as tf
-import argparse
-import sys
-
-
-def wrap_frozen_graph(graph_def, inputs, outputs):
- def _imports_graph_def():
- tf.compat.v1.import_graph_def(graph_def, name="")
-
- wrapped_import = tf.compat.v1.wrap_function(_imports_graph_def, [])
- import_graph = wrapped_import.graph
- return wrapped_import.prune(
- tf.nest.map_structure(import_graph.as_graph_element, inputs),
- tf.nest.map_structure(import_graph.as_graph_element, outputs))
-
-
-def _get_parser():
- """
- Returns an ArgumentParser for TensorFlow Lite Converter.
- """
- parser = argparse.ArgumentParser(
- description=("Command line tool to run TensorFlow Lite Converter."))
-
- # Converter version.
- converter_version = parser.add_mutually_exclusive_group(required=True)
- converter_version.add_argument(
- "--v1", action="store_true", help="Use TensorFlow Lite Converter 1.x")
- converter_version.add_argument(
- "--v2", action="store_true", help="Use TensorFlow Lite Converter 2.x")
-
- # Input and output path.
- parser.add_argument(
- "--input_path", type=str, help="Full filepath of the input file.", required=True)
- parser.add_argument(
- "--output_path",
- type=str,
- help="Full filepath of the output file.",
- required=True)
-
- # Input and output arrays.
- parser.add_argument(
- "--input_arrays",
- type=str,
- help="Names of the input arrays, comma-separated.",
- required=True)
- parser.add_argument(
- "--input_shapes",
- type=str,
- help="Shapes corresponding to --input_arrays, colon-separated.")
- parser.add_argument(
- "--output_arrays",
- type=str,
- help="Names of the output arrays, comma-separated.",
- required=True)
-
- return parser
-
-
-def _check_flags(flags):
- """
- Checks the parsed flags to ensure they are valid.
- """
- if flags.v1:
- invalid = ""
- # To be filled
-
- if invalid:
- raise ValueError(invalid + " options must be used with v2")
-
- if flags.v2:
- if tf.__version__.find("2.") != 0:
- raise ValueError(
- "Imported TensorFlow should have version >= 2.0 but you have " +
- tf.__version__)
-
- invalid = ""
- # To be filled
-
- if invalid:
- raise ValueError(invalid + " options must be used with v1")
-
- if flags.input_shapes:
- if not flags.input_arrays:
- raise ValueError("--input_shapes must be used with --input_arrays")
- if flags.input_shapes.count(":") != flags.input_arrays.count(","):
- raise ValueError("--input_shapes and --input_arrays must have the same "
- "number of items")
-
-
-def _parse_array(arrays, type_fn=str):
- return list(map(type_fn, arrays.split(",")))
-
-
-def _v1_convert(flags):
- input_shapes = None
- if flags.input_shapes:
- input_arrays = _parse_array(flags.input_arrays)
- input_shapes_list = [
- _parse_array(shape, type_fn=int) for shape in flags.input_shapes.split(":")
- ]
- input_shapes = dict(list(zip(input_arrays, input_shapes_list)))
-
- converter = tf.compat.v1.lite.TFLiteConverter.from_frozen_graph(
- flags.input_path, _parse_array(flags.input_arrays),
- _parse_array(flags.output_arrays), input_shapes)
-
- converter.allow_custom_ops = True
-
- tflite_model = converter.convert()
- open(flags.output_path, "wb").write(tflite_model)
-
-
-def _v2_convert(flags):
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(open(flags.input_path, 'rb').read())
-
- wrap_func = wrap_frozen_graph(
- graph_def,
- inputs=[_str + ":0" for _str in _parse_array(flags.input_arrays)],
- # TODO What if multiple outputs come in?
- outputs=[_str + ":0" for _str in _parse_array(flags.output_arrays)])
- converter = tf.lite.TFLiteConverter.from_concrete_functions([wrap_func])
-
- converter.allow_custom_ops = True
- converter.experimental_new_converter = True
-
- converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS]
-
- tflite_model = converter.convert()
- open(flags.output_path, "wb").write(tflite_model)
-
-
-def _convert(flags):
- if (flags.v1):
- _v1_convert(flags)
- else:
- _v2_convert(flags)
-
-
-"""
-Input frozen graph must be from TensorFlow 1.13.1
-"""
-
-
-def main():
- # Parse argument.
- parser = _get_parser()
-
- # Check if the flags are valid.
- flags = parser.parse_known_args(args=sys.argv[1:])
- _check_flags(flags[0])
-
- # Convert
- _convert(flags[0])
-
-
-if __name__ == "__main__":
- main()
diff --git a/tools/opencl_tool/CMakeLists.txt b/tools/opencl_tool/CMakeLists.txt
index d1bcb7000..68c0aae27 100644
--- a/tools/opencl_tool/CMakeLists.txt
+++ b/tools/opencl_tool/CMakeLists.txt
@@ -4,7 +4,7 @@ endif (NOT BUILD_OPENCL_TOOL)
list(APPEND OPENCL_INFO_SOURCE "src/opencl_info.cc")
-nnas_find_package(ARMCompute QUIET)
+nnfw_find_package(ARMCompute QUIET)
if(NOT ARMCompute_FOUND)
message(WARNING "Cannot find ARM Compute Library")
return()
diff --git a/tools/tflitefile_tool/README.md b/tools/tflitefile_tool/README.md
index e88669843..9253fd1cc 100644
--- a/tools/tflitefile_tool/README.md
+++ b/tools/tflitefile_tool/README.md
@@ -73,6 +73,21 @@ $
You can use range such as `107-120` in `opcodelist.txt` instead of using each operator index
+### Subgraph
+
+You can select subgraph to select operator. Default subgraph index is 0.
+If selected operators contain controlflow operator, the model to be generated will contain subgraphs of the selected controlflow operator.
+
+```
+$ cat /home/nnfw/opcodelist.txt
+11-13
+
+$ ./tools/tflitefile_tool/select_operator.py multi_subgraph.tflite
+opcodelist.txt test.tflite -g 1
+```
+
+Above selects operator index 11, 12, 13 in subgraph 1
+
## Colaboration model parser and model generator
1. Get imformation about base model using model parser
diff --git a/tools/tflitefile_tool/select_operator.py b/tools/tflitefile_tool/select_operator.py
index b122b62e9..1ad44a389 100755
--- a/tools/tflitefile_tool/select_operator.py
+++ b/tools/tflitefile_tool/select_operator.py
@@ -63,7 +63,44 @@ def GetOperatorList(oplist_file):
return opcode_list
-def GenerateOperatorCodes(new_builder, sample_model, used_operators_dic):
+def GetUsedSubgraphsList(sample_model, subg_num, operator_list, used_subgraphs_list):
+ import tflite.IfOptions
+ import tflite.WhileOptions
+
+ subg_list = []
+
+ selected_subgraph = sample_model.Subgraphs(subg_num)
+
+ for operator_idx in operator_list:
+ selected_operator = selected_subgraph.Operators(operator_idx)
+ if selected_operator.BuiltinOptionsType() == tflite.BuiltinOptions.BuiltinOptions(
+ ).IfOptions:
+ selected_builtin_option = selected_operator.BuiltinOptions()
+ if_option = tflite.IfOptions.IfOptions()
+ if_option.Init(selected_builtin_option.Bytes, selected_builtin_option.Pos)
+
+ subg_list.append(if_option.ElseSubgraphIndex())
+ subg_list.append(if_option.ThenSubgraphIndex())
+
+ if selected_operator.BuiltinOptionsType() == tflite.BuiltinOptions.BuiltinOptions(
+ ).WhileOptions:
+ selected_builtin_option = selected_operator.BuiltinOptions()
+ while_option = tflite.WhileOptions.WhileOptions()
+ while_option.Init(selected_builtin_option.Bytes, selected_builtin_option.Pos)
+
+ subg_list.append(while_option.BodySubgraphIndex())
+ subg_list.append(while_option.CondSubgraphIndex())
+
+ for idx in subg_list:
+ if idx not in used_subgraphs_list:
+ used_subgraphs_list.append(idx)
+ GetUsedSubgraphsList(sample_model, idx,
+ range(sample_model.Subgraphs(idx).OperatorsLength() - 1),
+ used_subgraphs_list)
+
+
+def GenerateOperatorCodes(new_builder, sample_model, used_opcodes_dic,
+ used_subgraphs_dic):
operator_code_num = sample_model.OperatorCodesLength()
new_operator_code_list = []
new_operator_code_string_list = {}
@@ -73,7 +110,7 @@ def GenerateOperatorCodes(new_builder, sample_model, used_operators_dic):
# Create operator_code string
for operator_code_idx in range(operator_code_num):
- if operator_code_idx in used_operators_dic:
+ if operator_code_idx in used_opcodes_dic:
operator_code = sample_model.OperatorCodes(operator_code_idx)
operator_code_string = operator_code.CustomCode()
if operator_code_string and (operator_code_string != "") and (
@@ -83,7 +120,7 @@ def GenerateOperatorCodes(new_builder, sample_model, used_operators_dic):
# Create tables of operator_code
for operator_code_idx in range(operator_code_num):
- if operator_code_idx in used_operators_dic:
+ if operator_code_idx in used_opcodes_dic:
operator_code = sample_model.OperatorCodes(operator_code_idx)
# Create operator_code table
@@ -138,7 +175,7 @@ def GenerateQuantization(new_builder, selected_quantization):
# Create zero_point vector
zeropoint_num = selected_quantization.ZeroPointLength()
if zeropoint_num != 0:
- tflite.QuantizationParameters.QuantizationParametersStartScaleVector(
+ tflite.QuantizationParameters.QuantizationParametersStartZeroPointVector(
new_builder, zeropoint_num)
for zeropoint_idx in reversed(range(zeropoint_num)):
new_builder.PrependInt64(selected_quantization.ZeroPoint(zeropoint_idx))
@@ -224,7 +261,8 @@ def GenerateTensors(new_builder, selected_subgraph, used_tensors_dic, used_buffe
return new_builder.EndVector(new_tensor_num)
-def GenerateBuiltinOption(new_builder, selected_builtin_option, builtin_option_type):
+def GenerateBuiltinOption(new_builder, selected_builtin_option, builtin_option_type,
+ used_subgraphs_dic):
# Conv2D option
import tflite.Conv2DOptions
@@ -847,28 +885,58 @@ def GenerateBuiltinOption(new_builder, selected_builtin_option, builtin_option_t
# MirrorPadOptions: not supported
# AbsOptions: not supported
# SplitVOptions: not supported
+
+ # IfOptions
+ import tflite.IfOptions
+ if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions().IfOptions:
+
+ if_option = tflite.IfOptions.IfOptions()
+ if_option.Init(selected_builtin_option.Bytes, selected_builtin_option.Pos)
+
+ tflite.IfOptions.IfOptionsStart(new_builder)
+ tflite.IfOptions.IfOptionsAddElseSubgraphIndex(
+ new_builder, used_subgraphs_dic[if_option.ElseSubgraphIndex()])
+ tflite.IfOptions.IfOptionsAddThenSubgraphIndex(
+ new_builder, used_subgraphs_dic[if_option.ThenSubgraphIndex()])
+ return tflite.IfOptions.IfOptionsEnd(new_builder)
+
+ # WhileOptions
+ import tflite.WhileOptions
+ if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions().WhileOptions:
+
+ while_option = tflite.WhileOptions.WhileOptions()
+ while_option.Init(selected_builtin_option.Bytes, selected_builtin_option.Pos)
+
+ tflite.WhileOptions.WhileOptionsStart(new_builder)
+ tflite.WhileOptions.WhileOptionsAddBodySubgraphIndex(
+ new_builder, used_subgraphs_dic[while_option.BodySubgraphIndex()])
+ tflite.WhileOptions.WhileOptionsAddCondSubgraphIndex(
+ new_builder, used_subgraphs_dic[while_option.CondSubgraphIndex()])
+ return tflite.WhileOptions.WhileOptionsEnd(new_builder)
+
# Cannot handle builtin option type yet
print("Cannot handle this option yet")
exit(1)
-def GenerateOperator(new_builder, selected_operator, used_tensors_dic,
- used_operators_dic):
+def GenerateOperator(new_builder, selected_operator, used_tensors_dic, used_opcodes_dic,
+ used_subgraphs_dic):
# define opcode_index
opcode_index = selected_operator.OpcodeIndex()
- new_opcode_index = used_operators_dic[opcode_index]
+ new_opcode_index = used_opcodes_dic[opcode_index]
# create input vector
input_num = selected_operator.InputsLength()
if input_num != 0:
- new_input_list = []
tflite.Operator.OperatorStartInputsVector(new_builder, input_num)
for input_idx in reversed(range(input_num)):
input_tensor_idx = selected_operator.Inputs(input_idx)
- new_input_tensor_idx = used_tensors_dic[input_tensor_idx]
+ if input_tensor_idx == -1:
+ new_input_tensor_idx = -1
+ else:
+ new_input_tensor_idx = used_tensors_dic[input_tensor_idx]
new_builder.PrependInt32(new_input_tensor_idx)
- new_input_list.append(new_input_tensor_idx)
new_input = new_builder.EndVector(input_num)
# create output_vector
@@ -885,8 +953,8 @@ def GenerateOperator(new_builder, selected_operator, used_tensors_dic,
builtin_option_type = selected_operator.BuiltinOptionsType()
if builtin_option_type != 0:
selected_builtin_option = selected_operator.BuiltinOptions()
- new_builtin_option = GenerateBuiltinOption(new_builder, selected_builtin_option,
- builtin_option_type)
+ new_builtin_option = GenerateBuiltinOption(
+ new_builder, selected_builtin_option, builtin_option_type, used_subgraphs_dic)
# Create custum option vector
custom_option_num = selected_operator.CustomOptionsLength()
@@ -915,8 +983,8 @@ def GenerateOperator(new_builder, selected_operator, used_tensors_dic,
return tflite.Operator.OperatorEnd(new_builder)
-def GenerateOperators(new_builder, selected_subgraph, opcode_list, used_tensors_dic,
- used_operators_dic):
+def GenerateOperators(new_builder, selected_subgraph, operator_list, used_tensors_dic,
+ used_opcodes_dic, used_subgraphs_dic):
operator_num = selected_subgraph.OperatorsLength()
new_operator_list = []
@@ -924,10 +992,11 @@ def GenerateOperators(new_builder, selected_subgraph, opcode_list, used_tensors_
return 0
for operator_idx in range(operator_num):
- if operator_idx in opcode_list:
+ if operator_idx in operator_list:
selected_operator = selected_subgraph.Operators(operator_idx)
new_operator = GenerateOperator(new_builder, selected_operator,
- used_tensors_dic, used_operators_dic)
+ used_tensors_dic, used_opcodes_dic,
+ used_subgraphs_dic)
new_operator_list.append(new_operator)
new_operator_num = len(new_operator_list)
@@ -941,9 +1010,9 @@ def GenerateOperators(new_builder, selected_subgraph, opcode_list, used_tensors_
return new_builder.EndVector(new_operator_num)
-def GenerateSubgraph(new_builder, selected_subgraph, opcode_list, new_input_tensor,
+def GenerateSubgraph(new_builder, selected_subgraph, operator_list, new_input_tensor,
new_output_tensor, used_tensors_dic, used_buffers_dic,
- used_operators_dic):
+ used_opcodes_dic, used_subgraphs_dic):
# Tensors
tensors = GenerateTensors(new_builder, selected_subgraph, used_tensors_dic,
@@ -961,15 +1030,15 @@ def GenerateSubgraph(new_builder, selected_subgraph, opcode_list, new_input_tens
# Create output vector for subgraph table
new_output_tensor_num = len(new_output_tensor)
if new_output_tensor_num != 0:
- tflite.SubGraph.SubGraphStartInputsVector(new_builder, new_output_tensor_num)
+ tflite.SubGraph.SubGraphStartOutputsVector(new_builder, new_output_tensor_num)
for output_tensor_idx in reversed(new_output_tensor):
new_output_tensor_idx = used_tensors_dic[output_tensor_idx]
new_builder.PrependInt32(new_output_tensor_idx)
new_outputs = new_builder.EndVector(new_output_tensor_num)
# Operators
- operators = GenerateOperators(new_builder, selected_subgraph, opcode_list,
- used_tensors_dic, used_operators_dic)
+ operators = GenerateOperators(new_builder, selected_subgraph, operator_list,
+ used_tensors_dic, used_opcodes_dic, used_subgraphs_dic)
# Name
subgraph_name = selected_subgraph.Name()
@@ -991,19 +1060,43 @@ def GenerateSubgraph(new_builder, selected_subgraph, opcode_list, new_input_tens
return tflite.SubGraph.SubGraphEnd(new_builder)
-def GenerateSubgraphs(new_builder, sample_model, opcode_list, new_input_tensor,
+def GenerateSubgraphs(args, new_builder, sample_model, operator_list, new_input_tensor,
new_output_tensor, used_tensors_dic, used_buffers_dic,
- used_operators_dic):
- new_subgraph_list = []
+ used_opcodes_dic, used_subgraphs_dic):
- # We think only main graph
- selected_subgraph = sample_model.Subgraphs(0)
- new_subgraph = GenerateSubgraph(new_builder, selected_subgraph, opcode_list,
- new_input_tensor, new_output_tensor, used_tensors_dic,
- used_buffers_dic, used_operators_dic)
- new_subgraph_list.append(new_subgraph)
+ new_subgraph_list = []
- new_subgraph_num = 1
+ # The selected subgraph will be primary subgraph of the model to be created newly
+ selected_subgraph = sample_model.Subgraphs(args.subgraph)
+
+ # k: old subg index, v: new subg index
+ # new subg index is sequential in used_subgraphs_dic
+ for k, v in used_subgraphs_dic.items():
+ print("Append subgraphs, old index : ", k, ", new index : ", v)
+ if k == args.subgraph:
+ assert v == 0
+ new_subgraph = GenerateSubgraph(new_builder, selected_subgraph, operator_list,
+ new_input_tensor, new_output_tensor,
+ used_tensors_dic, used_buffers_dic,
+ used_opcodes_dic, used_subgraphs_dic)
+ new_subgraph_list.append(new_subgraph)
+ else:
+ subg = sample_model.Subgraphs(k)
+ subg_opperator_idx_list = range(subg.OperatorsLength())
+ subg_input_tensors = subg.InputsAsNumpy()
+ subg_output_tensors = subg.OutputsAsNumpy()
+ subg_tensors = range(subg.TensorsLength())
+ subg_tensors_dic = {tensor_idx: tensor_idx for tensor_idx in subg_tensors}
+ subg_buffers_dic = {(subg.Tensors(idx)).Buffer():
+ (subg.Tensors(idx)).Buffer()
+ for idx in subg_tensors}
+ new_subgraph = GenerateSubgraph(new_builder, subg, subg_opperator_idx_list,
+ subg_input_tensors, subg_output_tensors,
+ subg_tensors_dic, subg_buffers_dic,
+ used_opcodes_dic, used_subgraphs_dic)
+ new_subgraph_list.append(new_subgraph)
+
+ new_subgraph_num = len(new_subgraph_list)
tflite.Model.ModelStartSubgraphsVector(new_builder, new_subgraph_num)
for subgraph_idx in reversed(range(new_subgraph_num)):
new_builder.PrependUOffsetTRelative(new_subgraph_list[subgraph_idx])
@@ -1055,19 +1148,20 @@ def GenerateBuffers(new_builder, sample_model, used_buffers_dic):
return new_builder.EndVector(new_buffer_num)
-def GenerateModel(new_builder, sample_model, opcode_list, new_input_tensors,
+def GenerateModel(args, new_builder, sample_model, operator_list, new_input_tensors,
new_output_tensors, used_tensors_dic, used_buffers_dic,
- used_operators_dic):
+ used_opcodes_dic, used_subgraphs_dic):
# uint
version = sample_model.Version()
# pointer of operator code 'table' vector
- operator_codes = GenerateOperatorCodes(new_builder, sample_model, used_operators_dic)
+ operator_codes = GenerateOperatorCodes(new_builder, sample_model, used_opcodes_dic,
+ used_subgraphs_dic)
# subgraphs
- subgraphs = GenerateSubgraphs(new_builder, sample_model, opcode_list,
+ subgraphs = GenerateSubgraphs(args, new_builder, sample_model, operator_list,
new_input_tensors, new_output_tensors, used_tensors_dic,
- used_buffers_dic, used_operators_dic)
+ used_buffers_dic, used_opcodes_dic, used_subgraphs_dic)
# description
description_string = new_builder.CreateString(sample_model.Description())
@@ -1107,41 +1201,61 @@ def main(args):
input_model_file = args.input_model
oplist_file = args.opcode_list
output_model_file = args.output_model
+ subgraph = args.subgraph
# Parse operator list file
- opcode_list = GetOperatorList(oplist_file)
+ operator_list = GetOperatorList(oplist_file)
# Get sample model and subgraph
# We use only 1st subgraph
sample_buf = input_model_file.read()
sample_buf = bytearray(sample_buf)
sample_model = tflite.Model.Model.GetRootAsModel(sample_buf, 0)
- sample_subgraph = sample_model.Subgraphs(0)
+ sample_subgraph = sample_model.Subgraphs(subgraph)
+
+ used_subgraphs_list = []
+ used_subgraphs_list.append(args.subgraph)
+ GetUsedSubgraphsList(sample_model, args.subgraph, operator_list, used_subgraphs_list)
+
+ used_subgraphs_dic = {}
+ for new_subgraph_idx in range(len(used_subgraphs_list)):
+ sample_subgraph_idx = used_subgraphs_list[new_subgraph_idx]
+ used_subgraphs_dic[sample_subgraph_idx] = new_subgraph_idx
# Collect used tensor & used operator
used_tensors = []
- used_operators = []
+ used_opcodes = []
- for opcode_idx in opcode_list:
- opcode = sample_subgraph.Operators(opcode_idx)
- for input_idx in range(opcode.InputsLength()):
- input_tensor_idx = opcode.Inputs(input_idx)
- if not input_tensor_idx in used_tensors:
+ for operator_idx in operator_list:
+ operator = sample_subgraph.Operators(operator_idx)
+ for input_idx in range(operator.InputsLength()):
+ input_tensor_idx = operator.Inputs(input_idx)
+ if not input_tensor_idx == -1 and not input_tensor_idx in used_tensors:
# default: same as input sample
used_tensors.append(input_tensor_idx)
- for output_idx in range(opcode.OutputsLength()):
- output_tensor_idx = opcode.Outputs(output_idx)
+ for output_idx in range(operator.OutputsLength()):
+ output_tensor_idx = operator.Outputs(output_idx)
if not output_tensor_idx in used_tensors:
# default: same as input sample
used_tensors.append(output_tensor_idx)
- opcode_idx = opcode.OpcodeIndex()
- if not opcode_idx in used_operators:
- used_operators.append(opcode_idx)
+ opcode_idx = operator.OpcodeIndex()
+ if not opcode_idx in used_opcodes:
+ used_opcodes.append(opcode_idx)
+
+ # Append opcodes of child subgraphs
+ for subgraph_idx in used_subgraphs_list:
+ if subgraph_idx == subgraph:
+ continue
+ for operator_idx in range(sample_model.Subgraphs(subgraph_idx).OperatorsLength()):
+ operator = sample_model.Subgraphs(subgraph_idx).Operators(operator_idx)
+ opcode_idx = operator.OpcodeIndex()
+ if not opcode_idx in used_opcodes:
+ used_opcodes.append(opcode_idx)
used_tensors.sort()
- used_operators.sort()
+ used_opcodes.sort()
# Collect used buffer
# buffer[0] should be blank. So it should start from 1
@@ -1151,14 +1265,23 @@ def main(args):
# key and value is same in prepare phase
buf_idx = (sample_subgraph.Tensors(used_tensor)).Buffer()
used_buffers.append(buf_idx)
+
+ # Append buffers of tensors of child subgraphs
+ for subgraph_idx in used_subgraphs_list:
+ if subgraph_idx == subgraph:
+ continue
+ for tensor_idx in range(sample_model.Subgraphs(subgraph_idx).TensorsLength()):
+ tensor = sample_model.Subgraphs(subgraph_idx).Tensors(tensor_idx)
+ used_buffers.append(tensor.Buffer())
+
used_buffers.sort()
# Assign new index for operator
- used_operators_dic = {}
+ used_opcodes_dic = {}
- for new_operator_idx in range(len(used_operators)):
- sample_operator_idx = used_operators[new_operator_idx]
- used_operators_dic[sample_operator_idx] = new_operator_idx
+ for new_operator_idx in range(len(used_opcodes)):
+ sample_operator_idx = used_opcodes[new_operator_idx]
+ used_opcodes_dic[sample_operator_idx] = new_operator_idx
# Assign new index for tensor
used_tensors_dic = {}
@@ -1178,10 +1301,12 @@ def main(args):
new_input_tensors = used_tensors[:]
new_output_tensors = used_tensors[:]
- for opcode_idx in opcode_list:
- opcode = sample_subgraph.Operators(opcode_idx)
- for input_idx in range(opcode.InputsLength()):
- input_tensor_idx = opcode.Inputs(input_idx)
+ for operator_idx in operator_list:
+ operator = sample_subgraph.Operators(operator_idx)
+ for input_idx in range(operator.InputsLength()):
+ input_tensor_idx = operator.Inputs(input_idx)
+ if input_tensor_idx == -1:
+ continue
if input_tensor_idx in new_output_tensors:
new_output_tensors.remove(input_tensor_idx)
if input_tensor_idx in new_input_tensors:
@@ -1190,8 +1315,8 @@ def main(args):
if matched_buffer.DataLength() != 0:
new_input_tensors.remove(input_tensor_idx)
- for output_idx in range(opcode.OutputsLength()):
- output_tensor_idx = opcode.Outputs(output_idx)
+ for output_idx in range(operator.OutputsLength()):
+ output_tensor_idx = operator.Outputs(output_idx)
if output_tensor_idx in new_input_tensors:
new_input_tensors.remove(output_tensor_idx)
if output_tensor_idx in new_output_tensors:
@@ -1214,9 +1339,9 @@ def main(args):
# Create new model file
new_builder = flatbuffers.Builder(1024)
- new_model = GenerateModel(new_builder, sample_model, opcode_list, new_input_tensors,
- new_output_tensors, used_tensors_dic, used_buffers_dic,
- used_operators_dic)
+ new_model = GenerateModel(args, new_builder, sample_model, operator_list,
+ new_input_tensors, new_output_tensors, used_tensors_dic,
+ used_buffers_dic, used_opcodes_dic, used_subgraphs_dic)
Finish(new_builder, new_model)
new_buf = new_builder.Output()
@@ -1237,6 +1362,14 @@ if __name__ == '__main__':
help="text file including selected operator list")
arg_parser.add_argument(
"output_model", type=argparse.FileType('wb'), help="output tflite model file")
+ arg_parser.add_argument(
+ '-g', '--subgraph', type=int, default=0, help="subgraph to use (default: 0)")
+
+ # TODO
+ # Select multiple subgraph
+ # Select subgraph by using opcode list file
+ # Select opcode list by using argument
+
args = arg_parser.parse_args()
# Call main function
diff --git a/tools/tflitefile_tool/subgraph_printer.py b/tools/tflitefile_tool/subgraph_printer.py
index c87f7816e..cce7ff53b 100755
--- a/tools/tflitefile_tool/subgraph_printer.py
+++ b/tools/tflitefile_tool/subgraph_printer.py
@@ -48,11 +48,13 @@ class SubgraphPrinter(object):
if self.print_all_tensor == False:
print('')
- self.PrintSpecificTensors()
+ self.PrintSpecificTensors(self.print_tensor_index_list)
+ print('')
if self.print_all_operator == False:
print('')
- self.PrintSpecificOperators()
+ self.PrintSpecificOperators(self.print_operator_index_list)
+ print('')
def PrintModelInfo(self):
print("[" + self.model_name + "]\n")
@@ -60,7 +62,9 @@ class SubgraphPrinter(object):
model_inputs = self.op_parser.tf_subgraph.InputsAsNumpy()
model_outputs = self.op_parser.tf_subgraph.OutputsAsNumpy()
print(self.model_name + " input tensors: " + str(model_inputs))
+ self.PrintSpecificTensors(model_inputs, "\t")
print(self.model_name + " output tensors: " + str(model_outputs))
+ self.PrintSpecificTensors(model_outputs, "\t")
print('')
def PrintAllOperatorsInList(self):
@@ -74,19 +78,13 @@ class SubgraphPrinter(object):
print('')
- def PrintSpecificTensors(self):
- for tensor in self.op_parser.GetAllTensors():
- if tensor.tensor_idx in self.print_tensor_index_list:
- printer = TensorPrinter(self.verbose, tensor)
- printer.PrintInfo()
- print('')
- print('')
+ def PrintSpecificTensors(self, print_tensor_index_list, depth_str=""):
+ for tensor in self.op_parser.GetTensors(print_tensor_index_list):
+ printer = TensorPrinter(self.verbose, tensor)
+ printer.PrintInfo(depth_str)
- def PrintSpecificOperators(self):
+ def PrintSpecificOperators(self, print_operator_index_list):
for operator in self.op_parser.operators_in_list:
- if operator.operator_idx in self.print_operator_index_list:
+ if operator.operator_idx in print_operator_index_list:
printer = OperatorPrinter(self.verbose, operator)
printer.PrintInfo()
- print('')
-
- print('')
diff --git a/tools/tflitefile_tool/tensor_printer.py b/tools/tflitefile_tool/tensor_printer.py
index f566a6e10..7c2904346 100755
--- a/tools/tflitefile_tool/tensor_printer.py
+++ b/tools/tflitefile_tool/tensor_printer.py
@@ -75,6 +75,10 @@ class TensorPrinter(object):
for shape_idx in range(self.tensor.tf_tensor.ShapeLength()):
if (shape_idx != 0):
return_string += ", "
- return_string += str(self.tensor.tf_tensor.Shape(shape_idx))
+ # when shape signature is -1, that means unknown dim
+ if self.tensor.tf_tensor.ShapeSignature(shape_idx) != -1:
+ return_string += str(self.tensor.tf_tensor.Shape(shape_idx))
+ else:
+ return_string += "-1"
return_string += "]"
return return_string
diff --git a/tools/tflitefile_tool/tflite/AbsOptions.py b/tools/tflitefile_tool/tflite/AbsOptions.py
index 748509293..6e95bdfba 100755..100644
--- a/tools/tflitefile_tool/tflite/AbsOptions.py
+++ b/tools/tflitefile_tool/tflite/AbsOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ActivationFunctionType.py b/tools/tflitefile_tool/tflite/ActivationFunctionType.py
index a32353964..a31039edd 100755..100644
--- a/tools/tflitefile_tool/tflite/ActivationFunctionType.py
+++ b/tools/tflitefile_tool/tflite/ActivationFunctionType.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class ActivationFunctionType(object):
diff --git a/tools/tflitefile_tool/tflite/AddNOptions.py b/tools/tflitefile_tool/tflite/AddNOptions.py
index cae1fcd3b..b928cafdb 100755..100644
--- a/tools/tflitefile_tool/tflite/AddNOptions.py
+++ b/tools/tflitefile_tool/tflite/AddNOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/AddOptions.py b/tools/tflitefile_tool/tflite/AddOptions.py
index c9f3387ca..3e1337f73 100755..100644
--- a/tools/tflitefile_tool/tflite/AddOptions.py
+++ b/tools/tflitefile_tool/tflite/AddOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ArgMaxOptions.py b/tools/tflitefile_tool/tflite/ArgMaxOptions.py
index 23cbfd731..699978c48 100755..100644
--- a/tools/tflitefile_tool/tflite/ArgMaxOptions.py
+++ b/tools/tflitefile_tool/tflite/ArgMaxOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ArgMinOptions.py b/tools/tflitefile_tool/tflite/ArgMinOptions.py
index 6a2dcdfe1..660c6a12e 100755..100644
--- a/tools/tflitefile_tool/tflite/ArgMinOptions.py
+++ b/tools/tflitefile_tool/tflite/ArgMinOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/BatchMatMulOptions.py b/tools/tflitefile_tool/tflite/BatchMatMulOptions.py
new file mode 100644
index 000000000..0b6d88f64
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/BatchMatMulOptions.py
@@ -0,0 +1,52 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+import flatbuffers
+
+
+class BatchMatMulOptions(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAsBatchMatMulOptions(cls, buf, offset):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = BatchMatMulOptions()
+ x.Init(buf, n + offset)
+ return x
+
+ # BatchMatMulOptions
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # BatchMatMulOptions
+ def AdjointLhs(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
+ # BatchMatMulOptions
+ def AdjointRhs(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
+
+def BatchMatMulOptionsStart(builder):
+ builder.StartObject(2)
+
+
+def BatchMatMulOptionsAddAdjointLhs(builder, adjointLhs):
+ builder.PrependBoolSlot(0, adjointLhs, 0)
+
+
+def BatchMatMulOptionsAddAdjointRhs(builder, adjointRhs):
+ builder.PrependBoolSlot(1, adjointRhs, 0)
+
+
+def BatchMatMulOptionsEnd(builder):
+ return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/BatchToSpaceNDOptions.py b/tools/tflitefile_tool/tflite/BatchToSpaceNDOptions.py
index 48a7d4c23..086cb8994 100755..100644
--- a/tools/tflitefile_tool/tflite/BatchToSpaceNDOptions.py
+++ b/tools/tflitefile_tool/tflite/BatchToSpaceNDOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/BidirectionalSequenceLSTMOptions.py b/tools/tflitefile_tool/tflite/BidirectionalSequenceLSTMOptions.py
index aefc64b41..d99ef58e1 100755..100644
--- a/tools/tflitefile_tool/tflite/BidirectionalSequenceLSTMOptions.py
+++ b/tools/tflitefile_tool/tflite/BidirectionalSequenceLSTMOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
@@ -56,9 +56,17 @@ class BidirectionalSequenceLSTMOptions(object):
self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
return True
+ # BidirectionalSequenceLSTMOptions
+ def AsymmetricQuantizeInputs(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
def BidirectionalSequenceLSTMOptionsStart(builder):
- builder.StartObject(5)
+ builder.StartObject(6)
def BidirectionalSequenceLSTMOptionsAddFusedActivationFunction(builder,
@@ -82,5 +90,10 @@ def BidirectionalSequenceLSTMOptionsAddTimeMajor(builder, timeMajor):
builder.PrependBoolSlot(4, timeMajor, 1)
+def BidirectionalSequenceLSTMOptionsAddAsymmetricQuantizeInputs(
+ builder, asymmetricQuantizeInputs):
+ builder.PrependBoolSlot(5, asymmetricQuantizeInputs, 0)
+
+
def BidirectionalSequenceLSTMOptionsEnd(builder):
return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/BidirectionalSequenceRNNOptions.py b/tools/tflitefile_tool/tflite/BidirectionalSequenceRNNOptions.py
index e1d4f6553..49f8d566e 100755..100644
--- a/tools/tflitefile_tool/tflite/BidirectionalSequenceRNNOptions.py
+++ b/tools/tflitefile_tool/tflite/BidirectionalSequenceRNNOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
@@ -42,9 +42,17 @@ class BidirectionalSequenceRNNOptions(object):
self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
return False
+ # BidirectionalSequenceRNNOptions
+ def AsymmetricQuantizeInputs(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
def BidirectionalSequenceRNNOptionsStart(builder):
- builder.StartObject(3)
+ builder.StartObject(4)
def BidirectionalSequenceRNNOptionsAddTimeMajor(builder, timeMajor):
@@ -60,5 +68,10 @@ def BidirectionalSequenceRNNOptionsAddMergeOutputs(builder, mergeOutputs):
builder.PrependBoolSlot(2, mergeOutputs, 0)
+def BidirectionalSequenceRNNOptionsAddAsymmetricQuantizeInputs(builder,
+ asymmetricQuantizeInputs):
+ builder.PrependBoolSlot(3, asymmetricQuantizeInputs, 0)
+
+
def BidirectionalSequenceRNNOptionsEnd(builder):
return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/Buffer.py b/tools/tflitefile_tool/tflite/Buffer.py
index d3fa8e9de..71ac5e717 100755..100644
--- a/tools/tflitefile_tool/tflite/Buffer.py
+++ b/tools/tflitefile_tool/tflite/Buffer.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/BuiltinOperator.py b/tools/tflitefile_tool/tflite/BuiltinOperator.py
index 28196bafb..30745ed50 100755..100644
--- a/tools/tflitefile_tool/tflite/BuiltinOperator.py
+++ b/tools/tflitefile_tool/tflite/BuiltinOperator.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class BuiltinOperator(object):
@@ -127,3 +127,7 @@ class BuiltinOperator(object):
NON_MAX_SUPPRESSION_V4 = 120
NON_MAX_SUPPRESSION_V5 = 121
SCATTER_ND = 122
+ SELECT_V2 = 123
+ DENSIFY = 124
+ SEGMENT_SUM = 125
+ BATCH_MATMUL = 126
diff --git a/tools/tflitefile_tool/tflite/BuiltinOptions.py b/tools/tflitefile_tool/tflite/BuiltinOptions.py
index a39c68b59..a20b9b18c 100755..100644
--- a/tools/tflitefile_tool/tflite/BuiltinOptions.py
+++ b/tools/tflitefile_tool/tflite/BuiltinOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class BuiltinOptions(object):
@@ -102,3 +102,7 @@ class BuiltinOptions(object):
NonMaxSuppressionV4Options = 95
NonMaxSuppressionV5Options = 96
ScatterNdOptions = 97
+ SelectV2Options = 98
+ DensifyOptions = 99
+ SegmentSumOptions = 100
+ BatchMatMulOptions = 101
diff --git a/tools/tflitefile_tool/tflite/CallOptions.py b/tools/tflitefile_tool/tflite/CallOptions.py
index a82f001fa..01d87aa15 100755..100644
--- a/tools/tflitefile_tool/tflite/CallOptions.py
+++ b/tools/tflitefile_tool/tflite/CallOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/CastOptions.py b/tools/tflitefile_tool/tflite/CastOptions.py
index 7f7a1dde3..cd415896c 100755..100644
--- a/tools/tflitefile_tool/tflite/CastOptions.py
+++ b/tools/tflitefile_tool/tflite/CastOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/CombinerType.py b/tools/tflitefile_tool/tflite/CombinerType.py
index dfe8afb9f..228213f70 100755..100644
--- a/tools/tflitefile_tool/tflite/CombinerType.py
+++ b/tools/tflitefile_tool/tflite/CombinerType.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class CombinerType(object):
diff --git a/tools/tflitefile_tool/tflite/ConcatEmbeddingsOptions.py b/tools/tflitefile_tool/tflite/ConcatEmbeddingsOptions.py
index 6ca04a51f..b0caaf30d 100755..100644
--- a/tools/tflitefile_tool/tflite/ConcatEmbeddingsOptions.py
+++ b/tools/tflitefile_tool/tflite/ConcatEmbeddingsOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ConcatenationOptions.py b/tools/tflitefile_tool/tflite/ConcatenationOptions.py
index ea089ac56..cf3da81da 100755..100644
--- a/tools/tflitefile_tool/tflite/ConcatenationOptions.py
+++ b/tools/tflitefile_tool/tflite/ConcatenationOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/Conv2DOptions.py b/tools/tflitefile_tool/tflite/Conv2DOptions.py
index 913729522..5fe0890f1 100755..100644
--- a/tools/tflitefile_tool/tflite/Conv2DOptions.py
+++ b/tools/tflitefile_tool/tflite/Conv2DOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/CosOptions.py b/tools/tflitefile_tool/tflite/CosOptions.py
index 51f2a7b0c..f046d0c8c 100755..100644
--- a/tools/tflitefile_tool/tflite/CosOptions.py
+++ b/tools/tflitefile_tool/tflite/CosOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/CustomOptionsFormat.py b/tools/tflitefile_tool/tflite/CustomOptionsFormat.py
index 18bc07d02..efb3eec6f 100755..100644
--- a/tools/tflitefile_tool/tflite/CustomOptionsFormat.py
+++ b/tools/tflitefile_tool/tflite/CustomOptionsFormat.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class CustomOptionsFormat(object):
diff --git a/tools/tflitefile_tool/tflite/CustomQuantization.py b/tools/tflitefile_tool/tflite/CustomQuantization.py
index 8cc1db1e2..9f6555cf1 100755..100644
--- a/tools/tflitefile_tool/tflite/CustomQuantization.py
+++ b/tools/tflitefile_tool/tflite/CustomQuantization.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/DensifyOptions.py b/tools/tflitefile_tool/tflite/DensifyOptions.py
new file mode 100644
index 000000000..4be460629
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/DensifyOptions.py
@@ -0,0 +1,28 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+import flatbuffers
+
+
+class DensifyOptions(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAsDensifyOptions(cls, buf, offset):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = DensifyOptions()
+ x.Init(buf, n + offset)
+ return x
+
+ # DensifyOptions
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+
+def DensifyOptionsStart(builder):
+ builder.StartObject(0)
+
+
+def DensifyOptionsEnd(builder):
+ return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/DepthToSpaceOptions.py b/tools/tflitefile_tool/tflite/DepthToSpaceOptions.py
index d56fb8a64..ef3281222 100755..100644
--- a/tools/tflitefile_tool/tflite/DepthToSpaceOptions.py
+++ b/tools/tflitefile_tool/tflite/DepthToSpaceOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/DepthwiseConv2DOptions.py b/tools/tflitefile_tool/tflite/DepthwiseConv2DOptions.py
index 786f7c53d..2708767a5 100755..100644
--- a/tools/tflitefile_tool/tflite/DepthwiseConv2DOptions.py
+++ b/tools/tflitefile_tool/tflite/DepthwiseConv2DOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/DequantizeOptions.py b/tools/tflitefile_tool/tflite/DequantizeOptions.py
index fe4cc9a06..39f058244 100755..100644
--- a/tools/tflitefile_tool/tflite/DequantizeOptions.py
+++ b/tools/tflitefile_tool/tflite/DequantizeOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/DimensionMetadata.py b/tools/tflitefile_tool/tflite/DimensionMetadata.py
new file mode 100644
index 000000000..585c11141
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/DimensionMetadata.py
@@ -0,0 +1,102 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+import flatbuffers
+
+
+class DimensionMetadata(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAsDimensionMetadata(cls, buf, offset):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = DimensionMetadata()
+ x.Init(buf, n + offset)
+ return x
+
+ # DimensionMetadata
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # DimensionMetadata
+ def Format(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
+ return 0
+
+ # DimensionMetadata
+ def DenseSize(self):
+ 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 0
+
+ # DimensionMetadata
+ def ArraySegmentsType(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
+ return 0
+
+ # DimensionMetadata
+ def ArraySegments(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
+ if o != 0:
+ from flatbuffers.table import Table
+ obj = Table(bytearray(), 0)
+ self._tab.Union(obj, o)
+ return obj
+ return None
+
+ # DimensionMetadata
+ def ArrayIndicesType(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
+ return 0
+
+ # DimensionMetadata
+ def ArrayIndices(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
+ if o != 0:
+ from flatbuffers.table import Table
+ obj = Table(bytearray(), 0)
+ self._tab.Union(obj, o)
+ return obj
+ return None
+
+
+def DimensionMetadataStart(builder):
+ builder.StartObject(6)
+
+
+def DimensionMetadataAddFormat(builder, format):
+ builder.PrependInt8Slot(0, format, 0)
+
+
+def DimensionMetadataAddDenseSize(builder, denseSize):
+ builder.PrependInt32Slot(1, denseSize, 0)
+
+
+def DimensionMetadataAddArraySegmentsType(builder, arraySegmentsType):
+ builder.PrependUint8Slot(2, arraySegmentsType, 0)
+
+
+def DimensionMetadataAddArraySegments(builder, arraySegments):
+ builder.PrependUOffsetTRelativeSlot(
+ 3, flatbuffers.number_types.UOffsetTFlags.py_type(arraySegments), 0)
+
+
+def DimensionMetadataAddArrayIndicesType(builder, arrayIndicesType):
+ builder.PrependUint8Slot(4, arrayIndicesType, 0)
+
+
+def DimensionMetadataAddArrayIndices(builder, arrayIndices):
+ builder.PrependUOffsetTRelativeSlot(
+ 5, flatbuffers.number_types.UOffsetTFlags.py_type(arrayIndices), 0)
+
+
+def DimensionMetadataEnd(builder):
+ return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/DimensionType.py b/tools/tflitefile_tool/tflite/DimensionType.py
new file mode 100644
index 000000000..500b410f1
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/DimensionType.py
@@ -0,0 +1,8 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+
+class DimensionType(object):
+ DENSE = 0
+ SPARSE_CSR = 1
diff --git a/tools/tflitefile_tool/tflite/DivOptions.py b/tools/tflitefile_tool/tflite/DivOptions.py
index 53bbae542..5cb472a34 100755..100644
--- a/tools/tflitefile_tool/tflite/DivOptions.py
+++ b/tools/tflitefile_tool/tflite/DivOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/EmbeddingLookupSparseOptions.py b/tools/tflitefile_tool/tflite/EmbeddingLookupSparseOptions.py
index 12531d3d5..f26010b82 100755..100644
--- a/tools/tflitefile_tool/tflite/EmbeddingLookupSparseOptions.py
+++ b/tools/tflitefile_tool/tflite/EmbeddingLookupSparseOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/EqualOptions.py b/tools/tflitefile_tool/tflite/EqualOptions.py
index 968712ff8..2ed67e50b 100755..100644
--- a/tools/tflitefile_tool/tflite/EqualOptions.py
+++ b/tools/tflitefile_tool/tflite/EqualOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ExpOptions.py b/tools/tflitefile_tool/tflite/ExpOptions.py
index f8c7bd867..2cd4b1ba8 100755..100644
--- a/tools/tflitefile_tool/tflite/ExpOptions.py
+++ b/tools/tflitefile_tool/tflite/ExpOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ExpandDimsOptions.py b/tools/tflitefile_tool/tflite/ExpandDimsOptions.py
index 2dd8d506c..f9b6f7e00 100755..100644
--- a/tools/tflitefile_tool/tflite/ExpandDimsOptions.py
+++ b/tools/tflitefile_tool/tflite/ExpandDimsOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/FakeQuantOptions.py b/tools/tflitefile_tool/tflite/FakeQuantOptions.py
index c266bfc9d..28844d45e 100755..100644
--- a/tools/tflitefile_tool/tflite/FakeQuantOptions.py
+++ b/tools/tflitefile_tool/tflite/FakeQuantOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/FillOptions.py b/tools/tflitefile_tool/tflite/FillOptions.py
index ee6273514..9780a70f3 100755..100644
--- a/tools/tflitefile_tool/tflite/FillOptions.py
+++ b/tools/tflitefile_tool/tflite/FillOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/FloorDivOptions.py b/tools/tflitefile_tool/tflite/FloorDivOptions.py
index 90b797112..e431c0b62 100755..100644
--- a/tools/tflitefile_tool/tflite/FloorDivOptions.py
+++ b/tools/tflitefile_tool/tflite/FloorDivOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/FloorModOptions.py b/tools/tflitefile_tool/tflite/FloorModOptions.py
index d2f7b3b48..867dc2f53 100755..100644
--- a/tools/tflitefile_tool/tflite/FloorModOptions.py
+++ b/tools/tflitefile_tool/tflite/FloorModOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/FullyConnectedOptions.py b/tools/tflitefile_tool/tflite/FullyConnectedOptions.py
index 76a31ef0e..07a1e9d69 100755..100644
--- a/tools/tflitefile_tool/tflite/FullyConnectedOptions.py
+++ b/tools/tflitefile_tool/tflite/FullyConnectedOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
@@ -41,9 +41,17 @@ class FullyConnectedOptions(object):
self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
return False
+ # FullyConnectedOptions
+ def AsymmetricQuantizeInputs(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
def FullyConnectedOptionsStart(builder):
- builder.StartObject(3)
+ builder.StartObject(4)
def FullyConnectedOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
@@ -58,5 +66,9 @@ def FullyConnectedOptionsAddKeepNumDims(builder, keepNumDims):
builder.PrependBoolSlot(2, keepNumDims, 0)
+def FullyConnectedOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQuantizeInputs):
+ builder.PrependBoolSlot(3, asymmetricQuantizeInputs, 0)
+
+
def FullyConnectedOptionsEnd(builder):
return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/FullyConnectedOptionsWeightsFormat.py b/tools/tflitefile_tool/tflite/FullyConnectedOptionsWeightsFormat.py
index 143fc5122..89537a712 100755..100644
--- a/tools/tflitefile_tool/tflite/FullyConnectedOptionsWeightsFormat.py
+++ b/tools/tflitefile_tool/tflite/FullyConnectedOptionsWeightsFormat.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class FullyConnectedOptionsWeightsFormat(object):
diff --git a/tools/tflitefile_tool/tflite/GatherNdOptions.py b/tools/tflitefile_tool/tflite/GatherNdOptions.py
index 3357d8526..68786fc47 100755..100644
--- a/tools/tflitefile_tool/tflite/GatherNdOptions.py
+++ b/tools/tflitefile_tool/tflite/GatherNdOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/GatherOptions.py b/tools/tflitefile_tool/tflite/GatherOptions.py
index cfb54496b..a91e5e9b3 100755..100644
--- a/tools/tflitefile_tool/tflite/GatherOptions.py
+++ b/tools/tflitefile_tool/tflite/GatherOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/GreaterEqualOptions.py b/tools/tflitefile_tool/tflite/GreaterEqualOptions.py
index 12df3c88c..ddeb1cd2e 100755..100644
--- a/tools/tflitefile_tool/tflite/GreaterEqualOptions.py
+++ b/tools/tflitefile_tool/tflite/GreaterEqualOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/GreaterOptions.py b/tools/tflitefile_tool/tflite/GreaterOptions.py
index 614cdb290..88c9d083b 100755..100644
--- a/tools/tflitefile_tool/tflite/GreaterOptions.py
+++ b/tools/tflitefile_tool/tflite/GreaterOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/HardSwishOptions.py b/tools/tflitefile_tool/tflite/HardSwishOptions.py
index 374c2dcf0..5fc4cd6c3 100755..100644
--- a/tools/tflitefile_tool/tflite/HardSwishOptions.py
+++ b/tools/tflitefile_tool/tflite/HardSwishOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/IfOptions.py b/tools/tflitefile_tool/tflite/IfOptions.py
index e5bf26907..07ffeea89 100755..100644
--- a/tools/tflitefile_tool/tflite/IfOptions.py
+++ b/tools/tflitefile_tool/tflite/IfOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/Int32Vector.py b/tools/tflitefile_tool/tflite/Int32Vector.py
new file mode 100644
index 000000000..2e63abea2
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/Int32Vector.py
@@ -0,0 +1,61 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+import flatbuffers
+
+
+class Int32Vector(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAsInt32Vector(cls, buf, offset):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = Int32Vector()
+ x.Init(buf, n + offset)
+ return x
+
+ # Int32Vector
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # Int32Vector
+ def Values(self, j):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ a = self._tab.Vector(o)
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return 0
+
+ # Int32Vector
+ def ValuesAsNumpy(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
+ return 0
+
+ # Int32Vector
+ def ValuesLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+
+def Int32VectorStart(builder):
+ builder.StartObject(1)
+
+
+def Int32VectorAddValues(builder, values):
+ builder.PrependUOffsetTRelativeSlot(
+ 0, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0)
+
+
+def Int32VectorStartValuesVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def Int32VectorEnd(builder):
+ return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/L2NormOptions.py b/tools/tflitefile_tool/tflite/L2NormOptions.py
index 1d3ab1ec8..88bc18995 100755..100644
--- a/tools/tflitefile_tool/tflite/L2NormOptions.py
+++ b/tools/tflitefile_tool/tflite/L2NormOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/LSHProjectionOptions.py b/tools/tflitefile_tool/tflite/LSHProjectionOptions.py
index 055eb75ff..6df83071a 100755..100644
--- a/tools/tflitefile_tool/tflite/LSHProjectionOptions.py
+++ b/tools/tflitefile_tool/tflite/LSHProjectionOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/LSHProjectionType.py b/tools/tflitefile_tool/tflite/LSHProjectionType.py
index 328179114..006886075 100755..100644
--- a/tools/tflitefile_tool/tflite/LSHProjectionType.py
+++ b/tools/tflitefile_tool/tflite/LSHProjectionType.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class LSHProjectionType(object):
diff --git a/tools/tflitefile_tool/tflite/LSTMKernelType.py b/tools/tflitefile_tool/tflite/LSTMKernelType.py
index f0e96f3fc..5afaf14e5 100755..100644
--- a/tools/tflitefile_tool/tflite/LSTMKernelType.py
+++ b/tools/tflitefile_tool/tflite/LSTMKernelType.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class LSTMKernelType(object):
diff --git a/tools/tflitefile_tool/tflite/LSTMOptions.py b/tools/tflitefile_tool/tflite/LSTMOptions.py
index 97c5bd8a4..499c21971 100755..100644
--- a/tools/tflitefile_tool/tflite/LSTMOptions.py
+++ b/tools/tflitefile_tool/tflite/LSTMOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
@@ -47,9 +47,17 @@ class LSTMOptions(object):
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
+ # LSTMOptions
+ def AsymmetricQuantizeInputs(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
def LSTMOptionsStart(builder):
- builder.StartObject(4)
+ builder.StartObject(5)
def LSTMOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
@@ -68,5 +76,9 @@ def LSTMOptionsAddKernelType(builder, kernelType):
builder.PrependInt8Slot(3, kernelType, 0)
+def LSTMOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQuantizeInputs):
+ builder.PrependBoolSlot(4, asymmetricQuantizeInputs, 0)
+
+
def LSTMOptionsEnd(builder):
return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/LeakyReluOptions.py b/tools/tflitefile_tool/tflite/LeakyReluOptions.py
index a4ffa3759..6dc6ab92c 100755..100644
--- a/tools/tflitefile_tool/tflite/LeakyReluOptions.py
+++ b/tools/tflitefile_tool/tflite/LeakyReluOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/LessEqualOptions.py b/tools/tflitefile_tool/tflite/LessEqualOptions.py
index ef93bcc9e..f5b3f128f 100755..100644
--- a/tools/tflitefile_tool/tflite/LessEqualOptions.py
+++ b/tools/tflitefile_tool/tflite/LessEqualOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/LessOptions.py b/tools/tflitefile_tool/tflite/LessOptions.py
index a94b37f17..e433a9c76 100755..100644
--- a/tools/tflitefile_tool/tflite/LessOptions.py
+++ b/tools/tflitefile_tool/tflite/LessOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/LocalResponseNormalizationOptions.py b/tools/tflitefile_tool/tflite/LocalResponseNormalizationOptions.py
index fd9117ac5..b995b08b0 100755..100644
--- a/tools/tflitefile_tool/tflite/LocalResponseNormalizationOptions.py
+++ b/tools/tflitefile_tool/tflite/LocalResponseNormalizationOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/LogSoftmaxOptions.py b/tools/tflitefile_tool/tflite/LogSoftmaxOptions.py
index 1b059d22f..2c9aefbaa 100755..100644
--- a/tools/tflitefile_tool/tflite/LogSoftmaxOptions.py
+++ b/tools/tflitefile_tool/tflite/LogSoftmaxOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/LogicalAndOptions.py b/tools/tflitefile_tool/tflite/LogicalAndOptions.py
index 84cdfd92a..4868d7e93 100755..100644
--- a/tools/tflitefile_tool/tflite/LogicalAndOptions.py
+++ b/tools/tflitefile_tool/tflite/LogicalAndOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/LogicalNotOptions.py b/tools/tflitefile_tool/tflite/LogicalNotOptions.py
index 966a419b7..84e1f6d17 100755..100644
--- a/tools/tflitefile_tool/tflite/LogicalNotOptions.py
+++ b/tools/tflitefile_tool/tflite/LogicalNotOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/LogicalOrOptions.py b/tools/tflitefile_tool/tflite/LogicalOrOptions.py
index 0a820cdaa..a619a4521 100755..100644
--- a/tools/tflitefile_tool/tflite/LogicalOrOptions.py
+++ b/tools/tflitefile_tool/tflite/LogicalOrOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/MatrixDiagOptions.py b/tools/tflitefile_tool/tflite/MatrixDiagOptions.py
index 658d562f8..0f101d73b 100755..100644
--- a/tools/tflitefile_tool/tflite/MatrixDiagOptions.py
+++ b/tools/tflitefile_tool/tflite/MatrixDiagOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/MatrixSetDiagOptions.py b/tools/tflitefile_tool/tflite/MatrixSetDiagOptions.py
index 3a19819d2..820594e32 100755..100644
--- a/tools/tflitefile_tool/tflite/MatrixSetDiagOptions.py
+++ b/tools/tflitefile_tool/tflite/MatrixSetDiagOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/MaximumMinimumOptions.py b/tools/tflitefile_tool/tflite/MaximumMinimumOptions.py
index c99494be3..a03c330e1 100755..100644
--- a/tools/tflitefile_tool/tflite/MaximumMinimumOptions.py
+++ b/tools/tflitefile_tool/tflite/MaximumMinimumOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/Metadata.py b/tools/tflitefile_tool/tflite/Metadata.py
index 25ee742bc..f4e319bad 100755..100644
--- a/tools/tflitefile_tool/tflite/Metadata.py
+++ b/tools/tflitefile_tool/tflite/Metadata.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/MirrorPadMode.py b/tools/tflitefile_tool/tflite/MirrorPadMode.py
index 85718ebf2..a2cdc815f 100755..100644
--- a/tools/tflitefile_tool/tflite/MirrorPadMode.py
+++ b/tools/tflitefile_tool/tflite/MirrorPadMode.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class MirrorPadMode(object):
diff --git a/tools/tflitefile_tool/tflite/MirrorPadOptions.py b/tools/tflitefile_tool/tflite/MirrorPadOptions.py
index 4d908e15b..591b84ea0 100755..100644
--- a/tools/tflitefile_tool/tflite/MirrorPadOptions.py
+++ b/tools/tflitefile_tool/tflite/MirrorPadOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/Model.py b/tools/tflitefile_tool/tflite/Model.py
index 37a408dbf..bb1fc9ea9 100755..100644
--- a/tools/tflitefile_tool/tflite/Model.py
+++ b/tools/tflitefile_tool/tflite/Model.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/MulOptions.py b/tools/tflitefile_tool/tflite/MulOptions.py
index e15c4d606..69a67e433 100755..100644
--- a/tools/tflitefile_tool/tflite/MulOptions.py
+++ b/tools/tflitefile_tool/tflite/MulOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/NegOptions.py b/tools/tflitefile_tool/tflite/NegOptions.py
index f3d98e782..904b1e03d 100755..100644
--- a/tools/tflitefile_tool/tflite/NegOptions.py
+++ b/tools/tflitefile_tool/tflite/NegOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/NonMaxSuppressionV4Options.py b/tools/tflitefile_tool/tflite/NonMaxSuppressionV4Options.py
index b8445203f..84713ef89 100755..100644
--- a/tools/tflitefile_tool/tflite/NonMaxSuppressionV4Options.py
+++ b/tools/tflitefile_tool/tflite/NonMaxSuppressionV4Options.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/NonMaxSuppressionV5Options.py b/tools/tflitefile_tool/tflite/NonMaxSuppressionV5Options.py
index d0c9dbcd0..d4ec4b5c7 100755..100644
--- a/tools/tflitefile_tool/tflite/NonMaxSuppressionV5Options.py
+++ b/tools/tflitefile_tool/tflite/NonMaxSuppressionV5Options.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/NotEqualOptions.py b/tools/tflitefile_tool/tflite/NotEqualOptions.py
index 25419ce53..92d30060b 100755..100644
--- a/tools/tflitefile_tool/tflite/NotEqualOptions.py
+++ b/tools/tflitefile_tool/tflite/NotEqualOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/OneHotOptions.py b/tools/tflitefile_tool/tflite/OneHotOptions.py
index fba03f85e..3bab3cfb7 100755..100644
--- a/tools/tflitefile_tool/tflite/OneHotOptions.py
+++ b/tools/tflitefile_tool/tflite/OneHotOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/Operator.py b/tools/tflitefile_tool/tflite/Operator.py
index b16ab783d..4278f91d3 100755..100644
--- a/tools/tflitefile_tool/tflite/Operator.py
+++ b/tools/tflitefile_tool/tflite/Operator.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/OperatorCode.py b/tools/tflitefile_tool/tflite/OperatorCode.py
index ca0b49ef3..46e419b48 100755..100644
--- a/tools/tflitefile_tool/tflite/OperatorCode.py
+++ b/tools/tflitefile_tool/tflite/OperatorCode.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/PackOptions.py b/tools/tflitefile_tool/tflite/PackOptions.py
index c1d5579fd..5d730d000 100755..100644
--- a/tools/tflitefile_tool/tflite/PackOptions.py
+++ b/tools/tflitefile_tool/tflite/PackOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/PadOptions.py b/tools/tflitefile_tool/tflite/PadOptions.py
index 46039443c..41a3013bc 100755..100644
--- a/tools/tflitefile_tool/tflite/PadOptions.py
+++ b/tools/tflitefile_tool/tflite/PadOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/PadV2Options.py b/tools/tflitefile_tool/tflite/PadV2Options.py
index bddea9d46..7028ce0b6 100755..100644
--- a/tools/tflitefile_tool/tflite/PadV2Options.py
+++ b/tools/tflitefile_tool/tflite/PadV2Options.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/Padding.py b/tools/tflitefile_tool/tflite/Padding.py
index b8b908c0c..99bd9668b 100755..100644
--- a/tools/tflitefile_tool/tflite/Padding.py
+++ b/tools/tflitefile_tool/tflite/Padding.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class Padding(object):
diff --git a/tools/tflitefile_tool/tflite/Pool2DOptions.py b/tools/tflitefile_tool/tflite/Pool2DOptions.py
index 26e46f243..437edf16b 100755..100644
--- a/tools/tflitefile_tool/tflite/Pool2DOptions.py
+++ b/tools/tflitefile_tool/tflite/Pool2DOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/PowOptions.py b/tools/tflitefile_tool/tflite/PowOptions.py
index 8368ac542..8f3b3a63e 100755..100644
--- a/tools/tflitefile_tool/tflite/PowOptions.py
+++ b/tools/tflitefile_tool/tflite/PowOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/QuantizationDetails.py b/tools/tflitefile_tool/tflite/QuantizationDetails.py
index 93e322e18..9025e2d72 100755..100644
--- a/tools/tflitefile_tool/tflite/QuantizationDetails.py
+++ b/tools/tflitefile_tool/tflite/QuantizationDetails.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class QuantizationDetails(object):
diff --git a/tools/tflitefile_tool/tflite/QuantizationParameters.py b/tools/tflitefile_tool/tflite/QuantizationParameters.py
index 7883acfff..26e3a39c9 100755..100644
--- a/tools/tflitefile_tool/tflite/QuantizationParameters.py
+++ b/tools/tflitefile_tool/tflite/QuantizationParameters.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/QuantizeOptions.py b/tools/tflitefile_tool/tflite/QuantizeOptions.py
index d86c757bc..2a3d50ee2 100755..100644
--- a/tools/tflitefile_tool/tflite/QuantizeOptions.py
+++ b/tools/tflitefile_tool/tflite/QuantizeOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/RNNOptions.py b/tools/tflitefile_tool/tflite/RNNOptions.py
index 508b9c8c9..c74d3e0f3 100755..100644
--- a/tools/tflitefile_tool/tflite/RNNOptions.py
+++ b/tools/tflitefile_tool/tflite/RNNOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
@@ -26,14 +26,26 @@ class RNNOptions(object):
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
+ # RNNOptions
+ def AsymmetricQuantizeInputs(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
def RNNOptionsStart(builder):
- builder.StartObject(1)
+ builder.StartObject(2)
def RNNOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
builder.PrependInt8Slot(0, fusedActivationFunction, 0)
+def RNNOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQuantizeInputs):
+ builder.PrependBoolSlot(1, asymmetricQuantizeInputs, 0)
+
+
def RNNOptionsEnd(builder):
return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/RangeOptions.py b/tools/tflitefile_tool/tflite/RangeOptions.py
index 917795f6a..cc19cd4e9 100755..100644
--- a/tools/tflitefile_tool/tflite/RangeOptions.py
+++ b/tools/tflitefile_tool/tflite/RangeOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/RankOptions.py b/tools/tflitefile_tool/tflite/RankOptions.py
index 84dc2a8ea..7a9967289 100755..100644
--- a/tools/tflitefile_tool/tflite/RankOptions.py
+++ b/tools/tflitefile_tool/tflite/RankOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ReducerOptions.py b/tools/tflitefile_tool/tflite/ReducerOptions.py
index 1f1a1b173..33f5dc065 100755..100644
--- a/tools/tflitefile_tool/tflite/ReducerOptions.py
+++ b/tools/tflitefile_tool/tflite/ReducerOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ReshapeOptions.py b/tools/tflitefile_tool/tflite/ReshapeOptions.py
index b6b2b3551..ad54290aa 100755..100644
--- a/tools/tflitefile_tool/tflite/ReshapeOptions.py
+++ b/tools/tflitefile_tool/tflite/ReshapeOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ResizeBilinearOptions.py b/tools/tflitefile_tool/tflite/ResizeBilinearOptions.py
index 76948948e..188e37527 100755..100644
--- a/tools/tflitefile_tool/tflite/ResizeBilinearOptions.py
+++ b/tools/tflitefile_tool/tflite/ResizeBilinearOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
@@ -27,14 +27,26 @@ class ResizeBilinearOptions(object):
self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
return False
+ # ResizeBilinearOptions
+ def HalfPixelCenters(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
def ResizeBilinearOptionsStart(builder):
- builder.StartObject(3)
+ builder.StartObject(4)
def ResizeBilinearOptionsAddAlignCorners(builder, alignCorners):
builder.PrependBoolSlot(2, alignCorners, 0)
+def ResizeBilinearOptionsAddHalfPixelCenters(builder, halfPixelCenters):
+ builder.PrependBoolSlot(3, halfPixelCenters, 0)
+
+
def ResizeBilinearOptionsEnd(builder):
return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/ResizeNearestNeighborOptions.py b/tools/tflitefile_tool/tflite/ResizeNearestNeighborOptions.py
index 5ce4f75ba..2d415181f 100755..100644
--- a/tools/tflitefile_tool/tflite/ResizeNearestNeighborOptions.py
+++ b/tools/tflitefile_tool/tflite/ResizeNearestNeighborOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ReverseSequenceOptions.py b/tools/tflitefile_tool/tflite/ReverseSequenceOptions.py
index cedcf2ab6..90068163a 100755..100644
--- a/tools/tflitefile_tool/tflite/ReverseSequenceOptions.py
+++ b/tools/tflitefile_tool/tflite/ReverseSequenceOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ReverseV2Options.py b/tools/tflitefile_tool/tflite/ReverseV2Options.py
index 7e801d8a9..338272008 100755..100644
--- a/tools/tflitefile_tool/tflite/ReverseV2Options.py
+++ b/tools/tflitefile_tool/tflite/ReverseV2Options.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SVDFOptions.py b/tools/tflitefile_tool/tflite/SVDFOptions.py
index 1e65dff4b..26ae85e96 100755..100644
--- a/tools/tflitefile_tool/tflite/SVDFOptions.py
+++ b/tools/tflitefile_tool/tflite/SVDFOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
@@ -33,9 +33,17 @@ class SVDFOptions(object):
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
+ # SVDFOptions
+ def AsymmetricQuantizeInputs(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
def SVDFOptionsStart(builder):
- builder.StartObject(2)
+ builder.StartObject(3)
def SVDFOptionsAddRank(builder, rank):
@@ -46,5 +54,9 @@ def SVDFOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
builder.PrependInt8Slot(1, fusedActivationFunction, 0)
+def SVDFOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQuantizeInputs):
+ builder.PrependBoolSlot(2, asymmetricQuantizeInputs, 0)
+
+
def SVDFOptionsEnd(builder):
return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/ScatterNdOptions.py b/tools/tflitefile_tool/tflite/ScatterNdOptions.py
index 711d804b9..eb0c153bb 100755..100644
--- a/tools/tflitefile_tool/tflite/ScatterNdOptions.py
+++ b/tools/tflitefile_tool/tflite/ScatterNdOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SegmentSumOptions.py b/tools/tflitefile_tool/tflite/SegmentSumOptions.py
new file mode 100644
index 000000000..09d226e32
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/SegmentSumOptions.py
@@ -0,0 +1,28 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+import flatbuffers
+
+
+class SegmentSumOptions(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAsSegmentSumOptions(cls, buf, offset):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = SegmentSumOptions()
+ x.Init(buf, n + offset)
+ return x
+
+ # SegmentSumOptions
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+
+def SegmentSumOptionsStart(builder):
+ builder.StartObject(0)
+
+
+def SegmentSumOptionsEnd(builder):
+ return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/SelectOptions.py b/tools/tflitefile_tool/tflite/SelectOptions.py
index 5539a87df..fb3dc2536 100755..100644
--- a/tools/tflitefile_tool/tflite/SelectOptions.py
+++ b/tools/tflitefile_tool/tflite/SelectOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SelectV2Options.py b/tools/tflitefile_tool/tflite/SelectV2Options.py
new file mode 100644
index 000000000..4171659cd
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/SelectV2Options.py
@@ -0,0 +1,28 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+import flatbuffers
+
+
+class SelectV2Options(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAsSelectV2Options(cls, buf, offset):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = SelectV2Options()
+ x.Init(buf, n + offset)
+ return x
+
+ # SelectV2Options
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+
+def SelectV2OptionsStart(builder):
+ builder.StartObject(0)
+
+
+def SelectV2OptionsEnd(builder):
+ return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/SequenceRNNOptions.py b/tools/tflitefile_tool/tflite/SequenceRNNOptions.py
index 2681296bb..3a501f70d 100755..100644
--- a/tools/tflitefile_tool/tflite/SequenceRNNOptions.py
+++ b/tools/tflitefile_tool/tflite/SequenceRNNOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
@@ -34,9 +34,17 @@ class SequenceRNNOptions(object):
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
+ # SequenceRNNOptions
+ def AsymmetricQuantizeInputs(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
def SequenceRNNOptionsStart(builder):
- builder.StartObject(2)
+ builder.StartObject(3)
def SequenceRNNOptionsAddTimeMajor(builder, timeMajor):
@@ -47,5 +55,9 @@ def SequenceRNNOptionsAddFusedActivationFunction(builder, fusedActivationFunctio
builder.PrependInt8Slot(1, fusedActivationFunction, 0)
+def SequenceRNNOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQuantizeInputs):
+ builder.PrependBoolSlot(2, asymmetricQuantizeInputs, 0)
+
+
def SequenceRNNOptionsEnd(builder):
return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/ShapeOptions.py b/tools/tflitefile_tool/tflite/ShapeOptions.py
index 939e27b88..cf38fc02d 100755..100644
--- a/tools/tflitefile_tool/tflite/ShapeOptions.py
+++ b/tools/tflitefile_tool/tflite/ShapeOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SkipGramOptions.py b/tools/tflitefile_tool/tflite/SkipGramOptions.py
index 9eb5059ea..07130e729 100755..100644
--- a/tools/tflitefile_tool/tflite/SkipGramOptions.py
+++ b/tools/tflitefile_tool/tflite/SkipGramOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SliceOptions.py b/tools/tflitefile_tool/tflite/SliceOptions.py
index 2cce3a00c..b71b18925 100755..100644
--- a/tools/tflitefile_tool/tflite/SliceOptions.py
+++ b/tools/tflitefile_tool/tflite/SliceOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SoftmaxOptions.py b/tools/tflitefile_tool/tflite/SoftmaxOptions.py
index 05571f2f5..328aeadbd 100755..100644
--- a/tools/tflitefile_tool/tflite/SoftmaxOptions.py
+++ b/tools/tflitefile_tool/tflite/SoftmaxOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SpaceToBatchNDOptions.py b/tools/tflitefile_tool/tflite/SpaceToBatchNDOptions.py
index ee31e0d5f..2fdcfbe43 100755..100644
--- a/tools/tflitefile_tool/tflite/SpaceToBatchNDOptions.py
+++ b/tools/tflitefile_tool/tflite/SpaceToBatchNDOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SpaceToDepthOptions.py b/tools/tflitefile_tool/tflite/SpaceToDepthOptions.py
index 277fa1aa5..b95a65e79 100755..100644
--- a/tools/tflitefile_tool/tflite/SpaceToDepthOptions.py
+++ b/tools/tflitefile_tool/tflite/SpaceToDepthOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SparseIndexVector.py b/tools/tflitefile_tool/tflite/SparseIndexVector.py
new file mode 100644
index 000000000..f676d00d9
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/SparseIndexVector.py
@@ -0,0 +1,10 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+
+class SparseIndexVector(object):
+ NONE = 0
+ Int32Vector = 1
+ Uint16Vector = 2
+ Uint8Vector = 3
diff --git a/tools/tflitefile_tool/tflite/SparseToDenseOptions.py b/tools/tflitefile_tool/tflite/SparseToDenseOptions.py
index 952d08fc1..82f160f0f 100755..100644
--- a/tools/tflitefile_tool/tflite/SparseToDenseOptions.py
+++ b/tools/tflitefile_tool/tflite/SparseToDenseOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SparsityParameters.py b/tools/tflitefile_tool/tflite/SparsityParameters.py
new file mode 100644
index 000000000..aa432868b
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/SparsityParameters.py
@@ -0,0 +1,123 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+import flatbuffers
+
+
+class SparsityParameters(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAsSparsityParameters(cls, buf, offset):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = SparsityParameters()
+ x.Init(buf, n + offset)
+ return x
+
+ # SparsityParameters
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # SparsityParameters
+ def TraversalOrder(self, j):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ a = self._tab.Vector(o)
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return 0
+
+ # SparsityParameters
+ def TraversalOrderAsNumpy(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
+ return 0
+
+ # SparsityParameters
+ def TraversalOrderLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+ # SparsityParameters
+ def BlockMap(self, j):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
+ if o != 0:
+ a = self._tab.Vector(o)
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return 0
+
+ # SparsityParameters
+ def BlockMapAsNumpy(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
+ if o != 0:
+ return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
+ return 0
+
+ # SparsityParameters
+ def BlockMapLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+ # SparsityParameters
+ def DimMetadata(self, j):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
+ if o != 0:
+ x = self._tab.Vector(o)
+ x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
+ x = self._tab.Indirect(x)
+ from .DimensionMetadata import DimensionMetadata
+ obj = DimensionMetadata()
+ obj.Init(self._tab.Bytes, x)
+ return obj
+ return None
+
+ # SparsityParameters
+ def DimMetadataLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+
+def SparsityParametersStart(builder):
+ builder.StartObject(3)
+
+
+def SparsityParametersAddTraversalOrder(builder, traversalOrder):
+ builder.PrependUOffsetTRelativeSlot(
+ 0, flatbuffers.number_types.UOffsetTFlags.py_type(traversalOrder), 0)
+
+
+def SparsityParametersStartTraversalOrderVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def SparsityParametersAddBlockMap(builder, blockMap):
+ builder.PrependUOffsetTRelativeSlot(
+ 1, flatbuffers.number_types.UOffsetTFlags.py_type(blockMap), 0)
+
+
+def SparsityParametersStartBlockMapVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def SparsityParametersAddDimMetadata(builder, dimMetadata):
+ builder.PrependUOffsetTRelativeSlot(
+ 2, flatbuffers.number_types.UOffsetTFlags.py_type(dimMetadata), 0)
+
+
+def SparsityParametersStartDimMetadataVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def SparsityParametersEnd(builder):
+ return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/SplitOptions.py b/tools/tflitefile_tool/tflite/SplitOptions.py
index a591e2e1e..851464224 100755..100644
--- a/tools/tflitefile_tool/tflite/SplitOptions.py
+++ b/tools/tflitefile_tool/tflite/SplitOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SplitVOptions.py b/tools/tflitefile_tool/tflite/SplitVOptions.py
index 37816ce5b..699715e49 100755..100644
--- a/tools/tflitefile_tool/tflite/SplitVOptions.py
+++ b/tools/tflitefile_tool/tflite/SplitVOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SquareOptions.py b/tools/tflitefile_tool/tflite/SquareOptions.py
index 0f9f5af9e..83d2e4172 100755..100644
--- a/tools/tflitefile_tool/tflite/SquareOptions.py
+++ b/tools/tflitefile_tool/tflite/SquareOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SquaredDifferenceOptions.py b/tools/tflitefile_tool/tflite/SquaredDifferenceOptions.py
index 17e022f34..ffe51fb65 100755..100644
--- a/tools/tflitefile_tool/tflite/SquaredDifferenceOptions.py
+++ b/tools/tflitefile_tool/tflite/SquaredDifferenceOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SqueezeOptions.py b/tools/tflitefile_tool/tflite/SqueezeOptions.py
index 6881c114a..8407e38d9 100755..100644
--- a/tools/tflitefile_tool/tflite/SqueezeOptions.py
+++ b/tools/tflitefile_tool/tflite/SqueezeOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/StridedSliceOptions.py b/tools/tflitefile_tool/tflite/StridedSliceOptions.py
index 99db0da68..0de2eef80 100755..100644
--- a/tools/tflitefile_tool/tflite/StridedSliceOptions.py
+++ b/tools/tflitefile_tool/tflite/StridedSliceOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SubGraph.py b/tools/tflitefile_tool/tflite/SubGraph.py
index df9acd8ce..3de190730 100755..100644
--- a/tools/tflitefile_tool/tflite/SubGraph.py
+++ b/tools/tflitefile_tool/tflite/SubGraph.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/SubOptions.py b/tools/tflitefile_tool/tflite/SubOptions.py
index 29b3dcbfb..6c399a845 100755..100644
--- a/tools/tflitefile_tool/tflite/SubOptions.py
+++ b/tools/tflitefile_tool/tflite/SubOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/Tensor.py b/tools/tflitefile_tool/tflite/Tensor.py
index e5f13301c..75e4ebdc3 100755..100644
--- a/tools/tflitefile_tool/tflite/Tensor.py
+++ b/tools/tflitefile_tool/tflite/Tensor.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
@@ -83,9 +83,44 @@ class Tensor(object):
self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
return False
+ # Tensor
+ def Sparsity(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
+ if o != 0:
+ x = self._tab.Indirect(o + self._tab.Pos)
+ from .SparsityParameters import SparsityParameters
+ obj = SparsityParameters()
+ obj.Init(self._tab.Bytes, x)
+ return obj
+ return None
+
+ # Tensor
+ def ShapeSignature(self, j):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
+ if o != 0:
+ a = self._tab.Vector(o)
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return 0
+
+ # Tensor
+ def ShapeSignatureAsNumpy(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
+ if o != 0:
+ return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
+ return 0
+
+ # Tensor
+ def ShapeSignatureLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
def TensorStart(builder):
- builder.StartObject(6)
+ builder.StartObject(8)
def TensorAddShape(builder, shape):
@@ -119,5 +154,19 @@ def TensorAddIsVariable(builder, isVariable):
builder.PrependBoolSlot(5, isVariable, 0)
+def TensorAddSparsity(builder, sparsity):
+ builder.PrependUOffsetTRelativeSlot(
+ 6, flatbuffers.number_types.UOffsetTFlags.py_type(sparsity), 0)
+
+
+def TensorAddShapeSignature(builder, shapeSignature):
+ builder.PrependUOffsetTRelativeSlot(
+ 7, flatbuffers.number_types.UOffsetTFlags.py_type(shapeSignature), 0)
+
+
+def TensorStartShapeSignatureVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
def TensorEnd(builder):
return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/TensorType.py b/tools/tflitefile_tool/tflite/TensorType.py
index ac7fe2014..c425b623c 100755..100644
--- a/tools/tflitefile_tool/tflite/TensorType.py
+++ b/tools/tflitefile_tool/tflite/TensorType.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
class TensorType(object):
@@ -14,3 +14,4 @@ class TensorType(object):
INT16 = 7
COMPLEX64 = 8
INT8 = 9
+ FLOAT64 = 10
diff --git a/tools/tflitefile_tool/tflite/TileOptions.py b/tools/tflitefile_tool/tflite/TileOptions.py
index 59543fc31..0200561a2 100755..100644
--- a/tools/tflitefile_tool/tflite/TileOptions.py
+++ b/tools/tflitefile_tool/tflite/TileOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/TopKV2Options.py b/tools/tflitefile_tool/tflite/TopKV2Options.py
index 004898943..e778ee43b 100755..100644
--- a/tools/tflitefile_tool/tflite/TopKV2Options.py
+++ b/tools/tflitefile_tool/tflite/TopKV2Options.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/TransposeConvOptions.py b/tools/tflitefile_tool/tflite/TransposeConvOptions.py
index d36a8437e..4bbe66666 100755..100644
--- a/tools/tflitefile_tool/tflite/TransposeConvOptions.py
+++ b/tools/tflitefile_tool/tflite/TransposeConvOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/TransposeOptions.py b/tools/tflitefile_tool/tflite/TransposeOptions.py
index b796686dd..86d79af63 100755..100644
--- a/tools/tflitefile_tool/tflite/TransposeOptions.py
+++ b/tools/tflitefile_tool/tflite/TransposeOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/Uint16Vector.py b/tools/tflitefile_tool/tflite/Uint16Vector.py
new file mode 100644
index 000000000..3f30e3ea9
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/Uint16Vector.py
@@ -0,0 +1,61 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+import flatbuffers
+
+
+class Uint16Vector(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAsUint16Vector(cls, buf, offset):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = Uint16Vector()
+ x.Init(buf, n + offset)
+ return x
+
+ # Uint16Vector
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # Uint16Vector
+ def Values(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.Uint16Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 2))
+ return 0
+
+ # Uint16Vector
+ def ValuesAsNumpy(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint16Flags, o)
+ return 0
+
+ # Uint16Vector
+ def ValuesLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+
+def Uint16VectorStart(builder):
+ builder.StartObject(1)
+
+
+def Uint16VectorAddValues(builder, values):
+ builder.PrependUOffsetTRelativeSlot(
+ 0, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0)
+
+
+def Uint16VectorStartValuesVector(builder, numElems):
+ return builder.StartVector(2, numElems, 2)
+
+
+def Uint16VectorEnd(builder):
+ return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/Uint8Vector.py b/tools/tflitefile_tool/tflite/Uint8Vector.py
new file mode 100644
index 000000000..02d3a293c
--- /dev/null
+++ b/tools/tflitefile_tool/tflite/Uint8Vector.py
@@ -0,0 +1,61 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: onert_tflite
+
+import flatbuffers
+
+
+class Uint8Vector(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAsUint8Vector(cls, buf, offset):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = Uint8Vector()
+ x.Init(buf, n + offset)
+ return x
+
+ # Uint8Vector
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # Uint8Vector
+ def Values(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.Uint8Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
+ return 0
+
+ # Uint8Vector
+ def ValuesAsNumpy(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
+ return 0
+
+ # Uint8Vector
+ def ValuesLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+
+def Uint8VectorStart(builder):
+ builder.StartObject(1)
+
+
+def Uint8VectorAddValues(builder, values):
+ builder.PrependUOffsetTRelativeSlot(
+ 0, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0)
+
+
+def Uint8VectorStartValuesVector(builder, numElems):
+ return builder.StartVector(1, numElems, 1)
+
+
+def Uint8VectorEnd(builder):
+ return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/UnidirectionalSequenceLSTMOptions.py b/tools/tflitefile_tool/tflite/UnidirectionalSequenceLSTMOptions.py
index ffbb6378f..ad6e3ca86 100755..100644
--- a/tools/tflitefile_tool/tflite/UnidirectionalSequenceLSTMOptions.py
+++ b/tools/tflitefile_tool/tflite/UnidirectionalSequenceLSTMOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
@@ -48,9 +48,17 @@ class UnidirectionalSequenceLSTMOptions(object):
self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
return False
+ # UnidirectionalSequenceLSTMOptions
+ def AsymmetricQuantizeInputs(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
+ if o != 0:
+ return bool(
+ self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
def UnidirectionalSequenceLSTMOptionsStart(builder):
- builder.StartObject(4)
+ builder.StartObject(5)
def UnidirectionalSequenceLSTMOptionsAddFusedActivationFunction(
@@ -70,5 +78,10 @@ def UnidirectionalSequenceLSTMOptionsAddTimeMajor(builder, timeMajor):
builder.PrependBoolSlot(3, timeMajor, 0)
+def UnidirectionalSequenceLSTMOptionsAddAsymmetricQuantizeInputs(
+ builder, asymmetricQuantizeInputs):
+ builder.PrependBoolSlot(4, asymmetricQuantizeInputs, 0)
+
+
def UnidirectionalSequenceLSTMOptionsEnd(builder):
return builder.EndObject()
diff --git a/tools/tflitefile_tool/tflite/UniqueOptions.py b/tools/tflitefile_tool/tflite/UniqueOptions.py
index a8fdd2a28..673f4cf68 100755..100644
--- a/tools/tflitefile_tool/tflite/UniqueOptions.py
+++ b/tools/tflitefile_tool/tflite/UniqueOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/UnpackOptions.py b/tools/tflitefile_tool/tflite/UnpackOptions.py
index f580418e6..b0210ddb9 100755..100644
--- a/tools/tflitefile_tool/tflite/UnpackOptions.py
+++ b/tools/tflitefile_tool/tflite/UnpackOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/WhereOptions.py b/tools/tflitefile_tool/tflite/WhereOptions.py
index 11ff679d6..ad1cb029e 100755..100644
--- a/tools/tflitefile_tool/tflite/WhereOptions.py
+++ b/tools/tflitefile_tool/tflite/WhereOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/WhileOptions.py b/tools/tflitefile_tool/tflite/WhileOptions.py
index bae5bb969..3b2c07d37 100755..100644
--- a/tools/tflitefile_tool/tflite/WhileOptions.py
+++ b/tools/tflitefile_tool/tflite/WhileOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/ZerosLikeOptions.py b/tools/tflitefile_tool/tflite/ZerosLikeOptions.py
index ca0880ab0..bbb15bdb4 100755..100644
--- a/tools/tflitefile_tool/tflite/ZerosLikeOptions.py
+++ b/tools/tflitefile_tool/tflite/ZerosLikeOptions.py
@@ -1,6 +1,6 @@
# automatically generated by the FlatBuffers compiler, do not modify
-# namespace: tflite
+# namespace: onert_tflite
import flatbuffers
diff --git a/tools/tflitefile_tool/tflite/__init__.py b/tools/tflitefile_tool/tflite/__init__.py
index e69de29bb..e69de29bb 100755..100644
--- a/tools/tflitefile_tool/tflite/__init__.py
+++ b/tools/tflitefile_tool/tflite/__init__.py
diff --git a/tools/update_version/update-version b/tools/update_version/update-version
new file mode 100644
index 000000000..41693278b
--- /dev/null
+++ b/tools/update_version/update-version
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+set -eu
+
+progname=$(basename "${BASH_SOURCE[0]}")
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+nnfw_root="$( cd "${script_dir%*/*/*}" && pwd )"
+
+usage() {
+ echo "Usage: $progname version"
+ echo "Update all version information"
+ echo ""
+ echo "Options:"
+ echo " -h show this help"
+ echo ""
+ echo "Examples:"
+ echo " $progname 1.6.0"
+ exit 1
+}
+
+if [ $# -eq 0 ]; then
+ echo "For help, type $progname -h"
+ exit 1
+fi
+
+while getopts "ho:" OPTION; do
+case "${OPTION}" in
+ h) usage;;
+ ?) exit 1;;
+esac
+done
+
+shift $((OPTIND-1))
+
+if [ $# -ne 1 ]; then
+ echo "error: wrong argument (no argument or too many arguments)."
+ echo "For help, type $progname -h"
+ exit 1
+fi
+
+version=$1
+
+sed -i "s/^release = .*/release = \'$version\'/" ${nnfw_root}/docs/conf.py
+sed -i "s/^Version: .*/Version: $version/" ${nnfw_root}/packaging/nnfw.spec
+
+IFS=. read M m p <<< $version
+hex=$(printf '0x%08x' $(( (($M << 24)) | (($m << 8)) | $p )))
+sed -i "s/^#define NNFW_VERSION.*/#define NNFW_VERSION $hex/" ${nnfw_root}/runtime/onert/api/include/nnfw_version.h
+
+sed -i "s/versionName .*$/versionName \"$version\"/" ${nnfw_root}/runtime/contrib/android/api/build.gradle