bundles / scipy 1.17.1 / scipy / _lib / array_api_compat / common / _helpers / size
function
scipy._lib.array_api_compat.common._helpers:size
source: /scipy/_lib/array_api_compat/common/_helpers.py :923
Signature
def size ( x : HasShape[Collection[SupportsIndex | None]] ) → int | None Summary
Return the total number of elements of x.
Extended Summary
This is equivalent to x.size according to the standard.
This helper is included because PyTorch defines size in an incompatible way <torch.Tensor.size>. It also fixes dask.array's behaviour which returns nan for unknown sizes, whereas the standard requires None.
Aliases
-
scipy.signal._filter_design.xp_size