def to_device(b, device=None, non_blocking=False):
    """
    Recursively put `b` on `device`
    components of b are torch tensors
    """
    if device is None: 
        device = default_device(use_cuda=True)

    if isinstance(b, dict):
        return {key: to_device(val, device) for key, val in b.items()}

    if isinstance(b, (list, tuple)):        
        return type(b)(to_device(o, device) for o in b)      
    
    return b.to(device, non_blocking=non_blocking)

    Recursively put `b` on `device`
    components of b are torch tensors
    
PatchTST_self_supervised/src/basics.py