diff options
Diffstat (limited to 'ethosu')
-rw-r--r-- | ethosu/vela/tensor.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py index 257cb5ff..c1443b3b 100644 --- a/ethosu/vela/tensor.py +++ b/ethosu/vela/tensor.py @@ -21,6 +21,7 @@ import uuid from collections import defaultdict from enum import auto from functools import lru_cache +from functools import total_ordering from typing import Dict from typing import List from typing import Optional @@ -342,6 +343,7 @@ class TensorAddressMap: cls.address_map[tens_id][mem_type] = address +@total_ordering class Tensor: __slots__ = ( "shape", @@ -841,6 +843,9 @@ class Tensor: return (self.dtype.type & BaseType.Int) != 0 and self.quantization.is_valid() + def __lt__(self, other: "Tensor") -> bool: + return self.equivalence_id < other.equivalence_id + def __str__(self): return "<nng.Tensor '%s' shape=%s dtype=%s>" % (self.name, self.shape, self.dtype) |