import torch


def pack(inputs, is_tensor=False):
    """Pack the inputs into tuple if they were a single tensor"""
    single = torch.is_tensor(inputs)
    outputs = (inputs, ) if single else inputs
    return (outputs, single) if is_tensor else outputs