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
diff --git a/ethosu/vela/shared_buffer_allocation.py b/ethosu/vela/shared_buffer_allocation.py
index 7268d9f..c968619 100644
--- a/ethosu/vela/shared_buffer_allocation.py
+++ b/ethosu/vela/shared_buffer_allocation.py
@@ -23,6 +23,7 @@
 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 @@
         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 @@
             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