diff options
Diffstat (limited to 'ethosu/vela/tensor.py')
-rw-r--r-- | ethosu/vela/tensor.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py index 5e97cfe8..42ba853d 100644 --- a/ethosu/vela/tensor.py +++ b/ethosu/vela/tensor.py @@ -181,6 +181,19 @@ class QuantizationParameters: __repr__ = __str__ + def __eq__(self, other): + if other is None: + return False + if not isinstance(other, QuantizationParameters): + return False + + pairs = ((getattr(self, s), getattr(other, s)) for s in QuantizationParameters.__slots__) + + return all(np.array_equal(a, b) for a, b in pairs) + + def __ne__(self, other): + return not self == other + def clone(self): res = QuantizationParameters() res.min = self.min |