broadcast_sparse_matrix#
- caf.distribute.array_utils.broadcast_sparse_matrix(array, target_array, array_dims=None)#
Expand an array to a target sparse matrix, matching target sparsity.
- Parameters:
array (COO | int | float) – Input array.
target_array (COO) – Target array to broadcast to. The return matrix will be as sparse and the same shape as this matrix.
array_dims (int | Sequence[int] | None) – The dimensions of target_array which correspond to array.
- Returns:
Array expanded to be the same shape and sparsity as target_array
- Return type:
expanded_array