Returns the total number of elements in the tensor. ```python exec="true" source="above" session="tensor" result="python" t = Tensor([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) print(t.numel()) ```
(self)
| 36 | return len(self.shape) |
| 37 | |
| 38 | def numel(self) -> sint: |
| 39 | """ |
| 40 | Returns the total number of elements in the tensor. |
| 41 | |
| 42 | ```python exec="true" source="above" session="tensor" result="python" |
| 43 | t = Tensor([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) |
| 44 | print(t.numel()) |
| 45 | ``` |
| 46 | """ |
| 47 | return prod(self.shape) |
| 48 | |
| 49 | def size(self, dim:int|None=None) -> sint|tuple[sint, ...]: |
| 50 | """ |