diff options
author | Tim Hall <tim.hall@arm.com> | 2022-11-03 12:25:33 +0000 |
---|---|---|
committer | Tim Hall <tim.hall@arm.com> | 2022-11-03 12:25:33 +0000 |
commit | 92cd33b7adbb799b6593d49f1d29c13a85933e55 (patch) | |
tree | 56b9d7a858950022a08e4e7e10d70cc648769b12 /ethosu/vela/reader_util.py | |
parent | b9f8159af8bb4e1eeb522f26852d8cbf90cb87a3 (diff) | |
download | ethos-u-vela-92cd33b7adbb799b6593d49f1d29c13a85933e55.tar.gz |
MLBEDSW-7082: Weight tensor shape is incorrect
- A bug was introduced by using the original_shape attribute that
causes CPU CONV2D ops to fail to run due to an incorrect weight
tensor shape
- This was due to the original_shape not being modified when a
transpose was performed on the weight tensor
- The fix was to transpose the original_shape just like the current
shape
Signed-off-by: Tim Hall <tim.hall@arm.com>
Change-Id: Ied72316463d26c502cf931b9dd5784041c42ab66
Diffstat (limited to 'ethosu/vela/reader_util.py')
-rw-r--r-- | ethosu/vela/reader_util.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/ethosu/vela/reader_util.py b/ethosu/vela/reader_util.py index b5a058e3..8ca1c156 100644 --- a/ethosu/vela/reader_util.py +++ b/ethosu/vela/reader_util.py @@ -15,8 +15,6 @@ # limitations under the License. # Description: # Utlity function for reading .tosa and .tflite files -import numpy as np - from .operation import Op from .operation import Operation @@ -30,20 +28,14 @@ def decode_str(s): def clone_and_reshape_tensor(src_tens, reorder, set_unique): tens = src_tens.clone("_reshape", set_unique) if reorder is None: - # 1D shape requested - tens.shape = [np.prod(src_tens.shape)] + # reorder of None is a special case meaning 1D shape requested + tens.as_1D() else: - tens.shape = [src_tens.shape[idx] for idx in reorder] + tens.transpose(reorder) + tens.bandwidth_shape = tens.shape tens.storage_shape = tens.shape - if tens.values is not None: - if reorder is None: - # 1D shape requested - tens.values = tens.values.reshape(tens.shape) - else: - tens.values = tens.values.transpose(reorder) - op = Operation(Op.Const, tens.name) op.set_output_tensor(tens) return tens |