def METHOD_NAME(x, indices):
    # create a boolean mask from subsample indices:
    #   + start with a zero tensor
    #   + at a specific `dim`, we increase by 1
    #     all entries which have index at `dim`
    #     belong to `indices[dim]`
    #   + at the end, we will get a tensor whose
    #     values at `indices` are `len(indices)`
    mask = x.new_zeros(x.shape, dtype=torch.long, device=x.device)
    if len(indices) > 0:
        idx = []
        for dim in range(-x.dim(), 0):
            if dim in indices:
                mask[idx + [indices[dim]]] += 1
            idx.append(slice(None))
    return mask == len(indices)