diff options
author | James Peet <james.peet@arm.com> | 2021-07-19 16:47:58 +0100 |
---|---|---|
committer | James Peet <james.peet@arm.com> | 2021-07-26 12:05:57 +0100 |
commit | 7519d50c993d60faa1ea09e56abfbf17cef23b49 (patch) | |
tree | 18bc526a1d1146dc3061f95418b1345bbdc481e8 /ethosu/vela/weight_compressor.py | |
parent | daed1529848465aab221a30008f455f9fa03c8d4 (diff) | |
download | ethos-u-vela-7519d50c993d60faa1ea09e56abfbf17cef23b49.tar.gz |
MLBEDSW-4892: Fix crash affecting biases without quantization.
Remove quant_values attribute from Tensor class.
It only needs a single values attribute, holding either
quantized or unquantized values as appropriate.
Change-Id: Ie96f80ac58061b6077e0f7048dc60209fdfbcafa
Signed-off-by: James Peet <james.peet@arm.com>
Diffstat (limited to 'ethosu/vela/weight_compressor.py')
-rw-r--r-- | ethosu/vela/weight_compressor.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ethosu/vela/weight_compressor.py b/ethosu/vela/weight_compressor.py index 7e33e93b..65361436 100644 --- a/ethosu/vela/weight_compressor.py +++ b/ethosu/vela/weight_compressor.py @@ -100,7 +100,7 @@ class CompressedWeightCache: def create_weight_compression_config(weight_tens, npu_block_type, ofm_block_depth, ofm_depth_step, dilation): # Note: for an ofm block only its depth is used in weight compression. # And block depth > ofm depth gives same result as block depth == ofm depth - block_depth = min(ofm_block_depth, weight_tens.quant_values.shape[-1]) + block_depth = min(ofm_block_depth, weight_tens.values.shape[-1]) return WeightCompressionConfig(npu_block_type, block_depth, ofm_depth_step, dilation, weight_tens.value_id) @@ -214,7 +214,7 @@ def _prepare_scale_and_bias(arch, tens, rescale_for_faf, explicit_scaling): # the operator should only have a single output assert len(tens.consumer_list[0].outputs) == 1 - biases = tens.quant_values + biases = tens.values first_consumer_op = tens.consumer_list[0] ifm_dtype = first_consumer_op.inputs[0].dtype @@ -318,7 +318,7 @@ def encode_weight_and_scale_tensor( assert weight_tens.quantization.zero_point is not None # Early zero-point correction - quant_buf = weight_tens.quant_values.astype(np.int16) + quant_buf = weight_tens.values.astype(np.int16) # the zero point can be either a native or numpy type if isinstance(weight_tens.quantization.zero_point, (int, float)): zero_point = np.int16(weight_tens.quantization.zero_point) @@ -363,7 +363,7 @@ def encode_weight_and_scale_tensor( scale_tens.element_size_bytes = 10 # Slice the weight stream up depth-ways into bricks and compress - full_ofm_depth = weight_tens.quant_values.shape[-1] + full_ofm_depth = weight_tens.values.shape[-1] ofm_block_depth = block_config.ofm_block.depth weight_range_index = 0 |