aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tflite_reader.py
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2020-07-30 18:36:52 +0100
committertim.hall <tim.hall@arm.com>2020-08-04 17:12:26 +0000
commit0430882a652368d1da1638114d4fbf8c8f7c8d7b (patch)
tree3795f505a1432b744cdd536e5d06200b4705fccd /ethosu/vela/tflite_reader.py
parent8677e539b234276a4aa102469f0ce349f0b72a39 (diff)
downloadethos-u-vela-0430882a652368d1da1638114d4fbf8c8f7c8d7b.tar.gz
MLBEDSW-2574: Fix issue with different bias tensor scaling
- In networks that share the scale & bias tensor between operators, differences in operator quantization causes conflicting HW packed scale & bias values for the tensor. This commit replicates the scale and bias tensors per operator, similar to weights handling, to avoid this conflct. Signed-off-by: <tim.hall@arm.com> Change-Id: Idee1fdf222ec849b6659adb0891b331d162524b7
Diffstat (limited to 'ethosu/vela/tflite_reader.py')
-rw-r--r--ethosu/vela/tflite_reader.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/ethosu/vela/tflite_reader.py b/ethosu/vela/tflite_reader.py
index be47cb13..9346b760 100644
--- a/ethosu/vela/tflite_reader.py
+++ b/ethosu/vela/tflite_reader.py
@@ -157,9 +157,11 @@ class TFLiteSubgraph:
if op_type.startswith("DepthwiseConv2d") or op_type.startswith("Conv2D"):
inputs[1] = clone_and_reshape_tensor(inputs[1], (1, 2, 3, 0))
+ inputs[2] = clone_and_reshape_tensor(inputs[2], (0,))
if op_type.startswith("FullyConnected"):
inputs[1] = clone_and_reshape_tensor(inputs[1], (1, 0))
+ inputs[2] = clone_and_reshape_tensor(inputs[2], (0,))
if opt_serializer is not None:
op.attrs = opt_serializer.deserialize(op_data)