

def convert(func):
    @wraps(func)
    def _convert(sequence, *args, **kwargs):
        if isinstance(sequence, torch.Tensor):
            return func(sequence, *args, **kwargs)
        elif isinstance(sequence, (list, tuple)):
            return [
                _convert(ip, *args, **kwargs) if ip is not None else None