MLBEDSW-4819: MLCE: weight_compressor int has no attribute astype

 - Added type checking so that the correct type conversion can be used

Signed-off-by: Tim Hall <tim.hall@arm.com>
Change-Id: Ia83f46029fac7bad63844c090b87d23c2072b105
diff --git a/ethosu/vela/weight_compressor.py b/ethosu/vela/weight_compressor.py
index 5f21139..4ba3dee 100644
--- a/ethosu/vela/weight_compressor.py
+++ b/ethosu/vela/weight_compressor.py
@@ -315,7 +315,12 @@
 
         # Early zero-point correction
         quant_buf = weight_tens.quant_values.astype(np.int16)
-        weights = quant_buf - weight_tens.quantization.zero_point.astype(np.int16)
+        # the zero point can be either a native or numpy type
+        if isinstance(weight_tens.quantization.zero_point, (int, float)):
+            zero_point = np.int16(weight_tens.quantization.zero_point)
+        else:
+            zero_point = weight_tens.quantization.zero_point.astype(np.int16)
+        weights = quant_buf - zero_point
 
         if len(weights.shape) == 2:
             weights = np.expand_dims(np.expand_dims(weights, axis=0), axis=0)