shape¶
- property array.shape: Tuple[int | None, ...]¶
Array dimensions.
- Returns:
out (Tuple[Optional[int], …]) – array dimensions. An array dimension must be
None
if and only if a dimension is unknown.
Note
For array libraries having graph-based computational models, array dimensions may be unknown due to data-dependent operations (e.g., boolean indexing;
A[:, B > 0]
) and thus cannot be statically resolved without knowing array contents.Note
The returned value should be a tuple; however, where warranted, an array library may choose to return a custom shape object. If an array library returns a custom shape object, the object must be immutable, must support indexing for dimension retrieval, and must behave similarly to a tuple.