mlx_graphs.utils.array_ops.index_to_mask#
- mlx_graphs.utils.array_ops.index_to_mask(index: mlx.core.array, size: int | None = None) mlx.core.array[source]#
Converts indices to a mask representation.
- Parameters:
- Return type:
- Returns:
A boolean array of length
size, with True at the givenindexindices and False elsewhere.
Example:
>>> index = mx.array([1, 2, 3]) >>> index_to_mask(index, size=5) array([False, True, True, True, False], dtype=bool)