diff --git a/ivy/__init__.py b/ivy/__init__.py index e75a3da420d9e..e5c5644307178 100644 --- a/ivy/__init__.py +++ b/ivy/__init__.py @@ -493,9 +493,7 @@ def numel(self): raise ivy.utils.exceptions.IvyException( "Cannot calculate the number of elements in a partially known Shape" ) - if self.rank > 0: - return ivy.prod(self._shape, dtype=ivy.int64).to_scalar() - return 1 + return ivy.prod(self.as_list(), dtype=ivy.int64).to_scalar() def __concat__(self, other): return self.concatenate(other)