(opt)
return (hasattr(opt, 'gpu_ranks') and len(opt.gpu_ranks) > 0) or \
        (hasattr(opt, 'gpu') and opt.gpu > -1)
Creates a boolean if gpu used
Creates a boolean if gpu used
Creates a boolean if gpu used
def use_gpu(opt):
    """
    Creates a boolean if gpu used
    """
    return (hasattr(opt, 'gpu_ranks') and len(opt.gpu_ranks) > 0) or \
        (hasattr(opt, 'gpu') and opt.gpu > -1)
def use_gpu ( opt ) : return ( hasattr ( opt , 'gpu_ranks' ) and len ( opt . gpu_ranks ) > 0 ) or ( hasattr ( opt , 'gpu' ) and opt . gpu > - 1 )