jax.pallas.tpu_sc.store_compressed

jax.pallas.tpu_sc.store_compressed#

jax.pallas.tpu_sc.store_compressed(ref, x, *, mask)[source]#

Performs a compressed masked store to a ref.

Elements from x where mask is True are placed into ref. The elements are written to ref sequentially, meaning the i-th True value in mask corresponds to writing to ref[i].

For example, if the mask is [True, False, True, True], the elements x[0], x[2], and x[3] are written to ref[0], ref[1], and ref[2] respectively.

Parameters:
  • ref (AbstractRef | TransformedRef) – The ref to store into.

  • x (Array) – The array to store. Must have the same shape as ref.

  • mask (Array) – A boolean mask specifying which elements from x to store.

Return type:

None