Skip to content

Commit

Permalink
Fixed lint errors and turned on the CMSIS_NN flag for config.cmake
Browse files Browse the repository at this point in the history
Change-Id: I333eb8be30ad5a74dcb0f4cb732b7fe29a5de74c
  • Loading branch information
ashutosh-arm committed Aug 26, 2021
1 parent 3a21249 commit 6a63601
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions python/tvm/relay/backend/contrib/cmsisnn/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ def is_quantized_softmax(self, call):
"""
if not self.call_contains_op(call, "qnn.quantize"):
return False
softmax_call = call.args[0]
if not self.call_contains_op(softmax_call, "nn.softmax"):
return False
dequantize_call = softmax_call.args[0]
if not self.call_contains_op(dequantize_call, "qnn.dequantize"):
return False
self.scale = call.args[1].data.numpy().item(0)
return True

Expand All @@ -56,8 +62,8 @@ def emit_softmax_tir(self, call):
ir_builder = tvm.tir.ir_builder.create()
in_buf = tvm.tir.decl_buffer(shape=shape, dtype=dtype)
out_buf = tvm.tir.decl_buffer(shape=shape, dtype=dtype)
trailing_dim = len(shape)-1

trailing_dim = len(shape) - 1
num_rows = 1
for dim in range(trailing_dim):
num_rows *= shape[dim]
Expand Down
1 change: 1 addition & 0 deletions tests/python/driver/tvmc/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def tflite_mobilenet_v1_0_25_128(tmpdir_factory):

return model_file


@pytest.fixture(scope="session")
def tflite_cnn_s_quantized(tmpdir_factory):
base_url = "https://github.com/ARM-software/ML-zoo/raw/master/models/keyword_spotting/cnn_small/tflite_int8/"
Expand Down
3 changes: 1 addition & 2 deletions tests/python/driver/tvmc/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,8 @@ def test_compile_tflite_module_with_external_codegen_cmsisnn(
pytest.importorskip("tflite")

output_dir = tmpdir_factory.mktemp("mlf")
output_dir = "./mlf"
tvmc_model = tvmc.load(tflite_cnn_s_quantized)

output_file_name = f"{output_dir}/file.tar"

tvmc_package = tvmc.compiler.compile_model(
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/task_config_build_cpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ echo set\(USE_TENSORFLOW_PATH \"/tensorflow\"\) >> config.cmake
echo set\(USE_FLATBUFFERS_PATH \"/flatbuffers\"\) >> config.cmake
echo set\(USE_ETHOSN /opt/arm/ethosn-driver\) >> config.cmake
echo set\(USE_ETHOSN_HW OFF\) >> config.cmake
echo set\(USE_CMSISNN OFF\) >> config.cmake
echo set\(USE_CMSISNN ON\) >> config.cmake
echo set\(USE_VITIS_AI ON\) >> config.cmake
echo set\(USE_VERILATOR ON\) >> config.cmake
echo set\(USE_LIBBACKTRACE ON\) >> config.cmake
Expand Down

0 comments on commit 6a63601

Please sign in to comment.