jax.experimental.pallas.Element

jax.experimental.pallas.Element#

class jax.experimental.pallas.Element(block_size, padding=(0, 0))[source]#

Indexes a dimension by element index rather than block index.

index_map returns the scalar start index i, slicing [i : i + block_size]. Optional padding=(lo, hi) virtually pads the dimension before slicing. Pad values read in the kernel are undefined.

block_shape=(Element(2), Element(3)), index_map -> (1, 2)
  array (4, 6):          ref (2, 3):
    . . . . . .            a b c
    . . a b c .     ->     d e f
    . . d e f .
    . . . . . .

block_shape=(Element(2, padding=(1, 2)), 4), index_map -> (0, 0)
  padded (5, 4):         ref (2, 4):
    ? ? ? ?  (lo=1)        ? ? ? ?   (?: undefined)
    -------         ->     a b c d
    a b c d
    . . . .
    -------
    ? ? ? ?  (hi=2)
    ? ? ? ?
Parameters:
__init__(block_size, padding=(0, 0))#
Parameters:
Return type:

None

Methods

__init__(block_size[, padding])

Attributes

padding

block_size