import torch


def in_top_k(targets: torch.LongTensor,
             preds: torch.Tensor,
             k: int
             ) -> list:
    """Return is `targets` in topk of `preds`.

    Args:
        `targets`: (batch_size, )
        `preds`: (batch_size, classes)

    Returns:
        (batch_size, )
    """
    topk = preds.topk(k)[1]  # topk returns (values, indices)
    return (targets.unsqueeze(1) == topk).any(dim=1).tolist()