diff options
author | Dwight Lidman <dwight.lidman@arm.com> | 2020-08-11 11:55:22 +0200 |
---|---|---|
committer | Fredrik Knutsson <fredrik.knutsson.hunnebo@gmail.com> | 2020-08-12 12:45:34 +0000 |
commit | 7ad408bd84e324f49f90c3a4ad01ee5f7ce9f1ba (patch) | |
tree | e2f5f171e55c7fa73e4f9ef8c8a9250d4f33661a | |
parent | c0bb8993268863c63ececf8d076a450c6a4f4dd5 (diff) | |
download | ethos-u-vela-7ad408bd84e324f49f90c3a4ad01ee5f7ce9f1ba.tar.gz |
MLBEDSW-2586: Null check before accessing tensor resampling mode
This commit amends a mistake where the resample_mode
attribute of a tensor would be accessed without checking
if the tensor in question was actually there first.
Signed-off-by: Dwight Lidman <dwight.lidman@arm.com>
Change-Id: Id2ceb1d6e38133611fcecfc2ac97150c927ceee2
-rw-r--r-- | ethosu/vela/shared_buffer_allocation.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ethosu/vela/shared_buffer_allocation.py b/ethosu/vela/shared_buffer_allocation.py index 7268d9f9..c9686194 100644 --- a/ethosu/vela/shared_buffer_allocation.py +++ b/ethosu/vela/shared_buffer_allocation.py @@ -23,6 +23,7 @@ from .architecture_features import Kernel from .architecture_features import SharedBufferArea from .architecture_features import SHRAMElements from .errors import VelaError +from .ethos_u55_regs.ethos_u55_regs import resampling_mode from .operation import NpuBlockType @@ -67,9 +68,11 @@ class SharedBufferAllocation: else: self.use_ifm_element = SHRAMElements.IFM8 + self.ifm_resampling_mode = resampling_mode.NONE self.ifm_bits = 0 self.ifm_depth = 0 if ifm_tensor: + self.ifm_resampling_mode = ifm_tensor.resampling_mode self.ifm_bits = ifm_tensor.dtype.size_in_bits() if ifm_tensor.shape == [] and is_elementwise: # Elementwise operator with scalar in ifm, use ifm2 depth @@ -87,7 +90,6 @@ class SharedBufferAllocation: else: assert self.ifm_bits == 8, "Unexpected IFM bitdepth" - self.ifm_resampling_mode = ifm_tensor.resampling_mode self.ifm_block_depth = arch.calc_ifm_block_depth(self.ifm_depth, self.ifm_bits) self.ofm_tensor = ofm_tensor |