import torch


def indices_to_mask(indices, size):
    """Converts a tensor of indices into a bool mask 1D tensor of the given size"""
    mask = torch.zeros((size,), dtype=torch.bool).to(indices.device)
    mask.scatter_(0, indices, True)
    return mask