pydims.fold#

pydims.fold(array, /, dim, *, sizes)[source]#

Fold a dimension of an array into a new set of dimensions.

Parameters:
  • array (TypeVar(DimArr, bound= DimensionedArray)) – Array to fold.

  • dim (Hashable) – Dimension to fold.

  • sizes (Mapping[Hashable, int]) – Sizes of the dimensions after folding.

Returns:

TypeVar(DimArr, bound= DimensionedArray) – Folded array.