def setup_device(self):
    num_gpus = torch.cuda.device_count()
    self.num_gpus = num_gpus
    if (num_gpus > 0):
        print_log_message('Using {} GPUs'.format(num_gpus))
    else:
        print_log_message('Using CPU')
    self.device = torch.device(('cuda:0' if (num_gpus > 0) else 'cpu'))
    self.use_multi_gpu = (True if (num_gpus > 1) else False)
    if torch.backends.cudnn.is_available():
        import torch.backends.cudnn as cudnn
        cudnn.benchmark = True
        cudnn.deterministic = True
def setup_device(self):
    num_gpus = torch.cuda.device_count()
    self.num_gpus = num_gpus
    if (num_gpus > 0):
        print_log_message('Using {} GPUs'.format(num_gpus))
    else:
        print_log_message('Using CPU')
    self.device = torch.device(('cuda:0' if (num_gpus > 0) else 'cpu'))
    self.use_multi_gpu = (True if (num_gpus > 1) else False)
    if torch.backends.cudnn.is_available():
        import torch.backends.cudnn as cudnn
        cudnn.benchmark = True
        cudnn.deterministic = True