legate.core.LogicalStore.broadcast#

LogicalStore.broadcast(
self,
int32_t dim,
size_t dim_size,
) LogicalStore#

Broadcasts a unit-size dimension of the store. The output store is a view to the input store where the dimension dim is broadcasted to size dim_size.

For example, For a 2D store A

[[1, 2, 3]]

A.broadcast(0, 3) yields the following output:

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

The broadcasting is logical; i.e., the broadcasted values are not materialized in the physical allocation.

The call can block if the store is unbound.

Parameters:
  • dim (int) – A dimension to broadcast. Must have size 1.

  • dim_size (int, optional) – A new size of the chosen dimension.

Returns:

A new store where the chosen dimension is logically broadcasted.

Return type:

LogicalStore

Raises:

ValueError – If dim is not a valid dimension index or the size of dimension dim is not 1.