legate.core.store.Store.delinearize#

Store.delinearize(dim: int, shape: tuple[int, ...]) Store#

Delinearizes a dimension into multiple dimensions. Each dimension i of the store, where i > dim, will be mapped to dimension i+N of the resulting store, where N is the length of shape. A delinearization that does not preserve the size of the store is invalid.

For example, consider a 2D store A

[[1, 2, 3, 4],
 [5, 6, 7, 8]]

A delinearizing call A.delinearize(1, [2, 2])) yields:

[[[1, 2],
  [3, 4]],

 [[5, 6],
  [7, 8]]]
Parameters:
  • dim (int) – Dimension to delinearize

  • shape (tuple[int]) – New shape for the chosen dimension

Returns:

A new store with the chosen dimension delinearized

Return type:

Store

Notes

Unlike other transformations, delinearization is not an affine transformation. Due to this nature, delinearized stores can raise NonInvertibleError in places where they cannot be used.

Raises:

ValueError – If dim is invalid for the store or shape does not preserve the size of the chosen dimenison