def is_tensor(v):
    """
    Return if an object is a torch Tensor, without importing torch.
    """
    if type(v).__module__.startswith('torch'):
        import torch
        return torch.is_tensor(v)
    return False
