From 940fdee086d77089c7669190392c92f4f2150348 Mon Sep 17 00:00:00 2001 From: Dwight Lidman Date: Thu, 13 Aug 2020 13:11:48 +0200 Subject: 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 Change-Id: I7a758f8d1b1237907816bc1be7b77aff765ae688 --- ethosu/vela/weight_compressor.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ethosu/vela/weight_compressor.py') diff --git a/ethosu/vela/weight_compressor.py b/ethosu/vela/weight_compressor.py index 45427a1a..a275e412 100644 --- a/ethosu/vela/weight_compressor.py +++ b/ethosu/vela/weight_compressor.py @@ -507,6 +507,8 @@ def update_pass_weight_and_scale_tensors(nng, arch): tens = ps.weight_tensor if tens is not None: op = tens.find_npu_op() + if op is None: + continue npu_usage_of_tensor = op.attrs["npu_block_type"] needs_dma = tens.needs_dma() if ps.cascade.strategy == SchedulingStrategy.WeightStream and needs_dma: -- cgit v1.2.1