Serialized/helper/miscellaneous.py
def device_by_name(name):
    ''' Return reference to cuda device by using Part of it's name
        
        Args:
            name: part of the cuda device name (shuuld be distinct
            
        Return:
            Reference to cuda device
            
        Updated: Yuval 12/10/19
    '''
    assert torch.cuda.is_available(),"No cuda device"
    device=None
    for i in range(torch.cuda.device_count()):
        dv=torch.device("cuda:{}".format(i))
        if name in torch.cuda.get_device_name(dv):
            device=dv
            break
    assert device, "device {} not found".format(name)
    return device
 Return reference to cuda device by using Part of it's name
        
        Args:
            name: part of the cuda device name (shuuld be distinct
            
        Return:
            Reference to cuda device
            
        Updated: Yuval 12/10/19
    
Return reference to cuda device by using Part of it's name
Return reference to cuda device by using Part of it ' s name
def device_by_name(name):
    assert torch.cuda.is_available(),"No cuda device"
    device=None
    for i in range(torch.cuda.device_count()):
        dv=torch.device("cuda:{}".format(i))
        if name in torch.cuda.get_device_name(dv):
            device=dv
            break
    assert device, "device {} not found".format(name)
    return device
def device_by_name ( name ) : assert torch . cuda . is_available ( ) , "No cuda device" device = None for i in range ( torch . cuda . device_count ( ) ) : dv = torch . device ( "cuda:{}" . format ( i ) ) if name in torch . cuda . get_device_name ( dv ) : device = dv break assert device , "device {} not found" . format ( name ) return device
Return reference to cuda device by using Part of it's name
Return reference to cuda device by using Part of it ' s name
''' Return reference to cuda device by using Part of it's name
        
        Args:
            name: part of the cuda device name (shuuld be distinct
            
        Return:
            Reference to cuda device
            
        Updated: Yuval 12/10/19
    '''
name
part of the cuda device name (shuuld be distinct
part of the cuda device name ( shuuld be distinct