diff options
author | Dwight Lidman <dwight.lidman@arm.com> | 2020-11-16 17:40:46 +0100 |
---|---|---|
committer | patrik.gustavsson <patrik.gustavsson@arm.com> | 2020-11-20 09:51:15 +0000 |
commit | c7187434c11151a6a03f252c8718f3bf6445ef5b (patch) | |
tree | c17655e6a888f567aa5dacc38eff54b5a348c00b /ethosu/vela/tensor.py | |
parent | 8956761a84f413e6f4c9c7d6e4409b145f81c289 (diff) | |
download | ethos-u-vela-c7187434c11151a6a03f252c8718f3bf6445ef5b.tar.gz |
MLBEDSW-3302: Reject per-channel scaling for unsupported ops
Vela only supports per-channel scaling for
convolution ops. This commit adds a check that
puts ops with per-channel scaling on the CPU.
A caveat worth mentioning is that neither
TensorFlow Lite or TensorFlow Lite Micro support
per-channel scaling for the CPU placed op,
however the problem is moved away from Vela.
This commit also changes a small utility function
in supported_operators.py used for docstring
formatting.
Signed-off-by: Dwight Lidman <dwight.lidman@arm.com>
Change-Id: I9ed090592f1d05dd4566d3e54dba1ef405299383
Diffstat (limited to 'ethosu/vela/tensor.py')
-rw-r--r-- | ethosu/vela/tensor.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py index 3601c929..b07b4dc3 100644 --- a/ethosu/vela/tensor.py +++ b/ethosu/vela/tensor.py @@ -246,6 +246,13 @@ class QuantizationParameters: return None not in (self.scale_f32, self.zero_point) + def is_per_axis(self): + """Returns True if either the scale, zero point, minimum or maximum values are arrays""" + for attr in ("scale_f32", "zero_point", "min", "max"): + if isinstance(getattr(self, attr), np.ndarray): + return True + return False + def create_const_tensor(name, shape, dtype, values, value_dtype=None, purpose=TensorPurpose.Unknown, quantization=None): # Tensor |