mygrad.Tensor.size#

property Tensor.size: int#

Number of elements in the tensor. i.e., the product of the tensor’s dimensions.

Returns
int

Examples

>>> import mygrad as mg
>>> x = mg.zeros((3, 5, 2))  # creates a tensor with 3x5x2 (= 30) elements
>>> x.size
30