Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#system files
__pycache__
.DS_Store
# virtual env
.venv
venv
Expand All @@ -20,4 +23,4 @@ tests/deep_mlp/data
.vscode
# docs
doc/build
doc/source/_build
doc/source/_build
688 changes: 356 additions & 332 deletions Pipfile.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class _Develop(_CompileFlatbuffMixin, _develop): pass
'graphviz',
'matplotlib',
'toml',
'flatbuffers',
'ortools',
],
extras_require={
Expand Down
13 changes: 13 additions & 0 deletions tests/test_frontend/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os

import pytest


@pytest.fixture(name='tflm_mnist_path', scope='session')
def tflm_mnist_path():
model_path = os.path.join(
os.path.dirname(__file__),
'model_files',
'quant_mnist_cnn.tflite'
)
return model_path
Binary file not shown.
11 changes: 11 additions & 0 deletions tests/test_frontend/test_tflite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def test_parser(tflm_mnist_path):
from utensor_cgen.frontend.tflite import TFLiteParser

parser = TFLiteParser({})
ugraph = parser.parse(tflm_mnist_path)

assert ugraph.output_nodes, \
'output_nodes is empty: {}'.format(ugraph.output_nodes)
assert ugraph.topo_order, \
'topo_order is empty: {}'.format(ugraph.topo_order)
assert ugraph.lib_name == 'tflite'
2 changes: 2 additions & 0 deletions utensor_cgen/backend/utensor/snippets/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def _init(cls):
tensor_type_str="uint16_t"),
np.dtype('int8'): _TYPE_MAP_VALUE(importer_type_str="int8",
tensor_type_str="q7_t"),
np.dtype('uint8'): _TYPE_MAP_VALUE(importer_type_str="uint8",
tensor_type_str="uint8_t"),
}
cls._inited = True

Expand Down
Loading