aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/mark_tensors.py
diff options
context:
space:
mode:
authorDwight Lidman <dwight.lidman@arm.com>2020-08-13 13:11:48 +0200
committertim.hall <tim.hall@arm.com>2020-08-18 18:52:46 +0000
commit940fdee086d77089c7669190392c92f4f2150348 (patch)
treebaa7769b3567ebd5b71491ad3d6a97772b7efbd0 /ethosu/vela/mark_tensors.py
parent29d568e73373e82ef2dd246a64ba399fe6da676a (diff)
downloadethos-u-vela-940fdee086d77089c7669190392c92f4f2150348.tar.gz
MLBEDSW-2589: Skip weight compression for CPU ops
This commit fixes a bug where CPU ops were getting passed on as NPU ops in weight_compressor.py due to Operation.find_npu_op() incorrectly returning any op with an 'npu_block_type' attribute (which every op has) as an NPU op. Signed-off-by: Dwight Lidman <dwight.lidman@arm.com> Change-Id: I7a758f8d1b1237907816bc1be7b77aff765ae688
Diffstat (limited to 'ethosu/vela/mark_tensors.py')
-rw-r--r--ethosu/vela/mark_tensors.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ethosu/vela/mark_tensors.py b/ethosu/vela/mark_tensors.py
index b6b2f9f4..40ce467b 100644
--- a/ethosu/vela/mark_tensors.py
+++ b/ethosu/vela/mark_tensors.py
@@ -371,10 +371,11 @@ def mark_tensor_format(nng, arch, verbose_tensor_format=False):
src_tens = tens.get_dma_src_tensor()
if src_tens is not None:
op = tens.find_npu_op()
- npu_block_type = op.attrs["npu_block_type"]
- weight_compressor.compress_weights(arch, nng, tens, npu_block_type, 16, 16, op.get_dilation_h_w())
- # Alias compressed weights back into source tensor
- src_tens.copy_compressed_weight_info(tens)
+ if op is not None:
+ npu_block_type = op.attrs["npu_block_type"]
+ weight_compressor.compress_weights(arch, nng, tens, npu_block_type, 16, 16, op.get_dilation_h_w())
+ # Alias compressed weights back into source tensor
+ src_tens.copy_compressed_weight_info(tens)
if verbose_tensor_format:
nng.print_passes_with_tensors()