diff options
author | Johan Alfven <johan.alfven@arm.com> | 2023-05-04 12:47:25 +0200 |
---|---|---|
committer | Johan Alfven <johan.alfven@arm.com> | 2023-05-04 17:32:39 +0200 |
commit | 7ede3176636c20465851daf9ff1f9210e4902264 (patch) | |
tree | c0c5a4ea1182c3945aae7a84741623b4231a8fef /ethosu | |
parent | 0a7d5ee98dfc8c881372bc5a50be37aed209c30e (diff) | |
download | ethos-u-vela-7ede3176636c20465851daf9ff1f9210e4902264.tar.gz |
MLBEDSW-7542: Fix output diff caused by wrong scaling in Conv2d
- The reference calculates the scale slightly different between
Conv2d and FullyConnect. Recently a fix was submitted to address
this issue. However, internally a Conv2d can be changed to a
FullyConnect but then the scale must still be calculated
following the Conv2d reference.
- The fix is to check the original type if FullyConnect scale
should be used or not.
Change-Id: I5a9fb49126f0df63712b73fb5520fdc604cee378
Signed-off-by: Johan Alfven <johan.alfven@arm.com>
Diffstat (limited to 'ethosu')
-rw-r--r-- | ethosu/vela/weight_compressor.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ethosu/vela/weight_compressor.py b/ethosu/vela/weight_compressor.py index a37ff6af..a258be41 100644 --- a/ethosu/vela/weight_compressor.py +++ b/ethosu/vela/weight_compressor.py @@ -284,7 +284,7 @@ def _prepare_scale_and_bias(arch, tens, rescale_for_faf, explicit_scaling): # TensorFlow Lite casts the scales slightly differently for uint8 and int8 as well as # for FullyConnected operators if not rescale_for_faf: - if ifm_dtype == DataType.uint8 or first_consumer_op.type == Op.FullyConnected: + if ifm_dtype == DataType.uint8 or first_consumer_op.original_type == Op.FullyConnected: scales = [np.double(ifm_scale * weight_scale) / np.double(ofm_scale) for weight_scale in weight_scales] elif ifm_dtype == DataType.int8 or ifm_dtype == DataType.int16: scales = [ |