flopscope.numpy.size
fnp.size(a, axis=None)[flopscope source][numpy source]
Return the number of elements along a given axis.
Adapted from NumPy docs np.size
Cost
0
Flopscope Context
Return number of elements in array.
Parameters
- a:array_like
Input data.
- axis:int, optional
Axis along which the elements are counted. By default, give the total number of elements.
Returns
- element_count:int
Number of elements along the specified axis.
See also
- we.flops.shape dimensions of array
- ndarray.shape dimensions of array
- ndarray.size number of elements in array
Examples
>>> import flopscope.numpy as fnp
>>> a = flops.array([[1,2,3],[4,5,6]])
>>> flops.size(a)
6
>>> flops.size(a,1)
3
>>> flops.size(a,0)
2