legate.core.store.Store.slice#

Store.slice(dim: int, sl: slice) Store#

Slices a contiguous sub-section of the store.

For example, consider a 2D store A

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

A slicing A.slice(0, slice(1, None)) yields:

[[4, 5, 6],
 [7, 8, 9]]

The result store will look like this on a different slicing call A.slice(1, slice(None, 2)):

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

Finally, chained slicing calls

A.slice(0, slice(1, None)).slice(1, slice(None, 2))

results in:

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

  • sl (slice) – Slice that expresses a sub-section

Returns:

A new store that correponds to the sliced section

Return type:

Store

Notes

Slicing with a non-unit step is currently not supported.

Raises:

ValueError – If sl.step is not a unit or sl is out of bounds