diff options
Diffstat (limited to 'ethosu/vela/tensor.py')
-rw-r--r-- | ethosu/vela/tensor.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py index 17d41b1a..ba385886 100644 --- a/ethosu/vela/tensor.py +++ b/ethosu/vela/tensor.py @@ -436,6 +436,17 @@ class Tensor: def is_standard_fm(self) -> bool: return self.sub_purpose == TensorSubPurpose.Standard and self.purpose == TensorPurpose.FeatureMap + @property + def is_const(self) -> bool: + return self.ops != [] and self.ops[0].type == Op.Const + + @property + def is_scalar(self) -> bool: + return self.shape == [] and self.elements() == 1 + + def is_broadcast(self, ofm) -> bool: + return self.shape != ofm.shape + def element_size(self) -> int: if self.element_size_bytes == 0: return self.dtype.size_in_bits() // 8 |