flopscope.

flopscope.numpy.shape

Return the shape of an array.

Adapted from NumPy docs np.shape

Areacore
Typefree
NumPy Refnp.shape
Cost
0
Flopscope Context

Return shape of array.

Parameters

a:array_like

Input array.

Returns

shape:tuple of ints

The elements of the shape tuple give the lengths of the corresponding array dimensions.

See also

Examples

>>> import flopscope.numpy as fnp
>>> flops.shape(flops.eye(3))
(3, 3)
>>> flops.shape([[1, 3]])
(1, 2)
>>> flops.shape([0])
(1,)
>>> flops.shape(0)
()
>>> a = flops.array([(1, 2), (3, 4), (5, 6)],
... dtype=[('x', 'i4'), ('y', 'i4')])
>>> flops.shape(a)
(3,)
>>> a.shape
(3,)