From 7d128755579dc91c69202a41571bcb7e04226065 Mon Sep 17 00:00:00 2001 From: Max Wu Date: Mon, 23 Dec 2019 23:51:40 -0800 Subject: [PATCH 1/2] made CPU training work --- models/networks/loss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/networks/loss.py b/models/networks/loss.py index b2485d77..b7b2c7f2 100644 --- a/models/networks/loss.py +++ b/models/networks/loss.py @@ -102,7 +102,7 @@ def __call__(self, input, target_is_real, for_discriminator=True): class VGGLoss(nn.Module): def __init__(self, gpu_ids): super(VGGLoss, self).__init__() - self.vgg = VGG19().cuda() + self.vgg = VGG19() if len(gpu_ids) == 0 else VGG19.cuda() self.criterion = nn.L1Loss() self.weights = [1.0 / 32, 1.0 / 16, 1.0 / 8, 1.0 / 4, 1.0] From f21f3dec853cd9d5412f7635973cc11217a99add Mon Sep 17 00:00:00 2001 From: Max Wu Date: Wed, 25 Dec 2019 14:56:33 -0800 Subject: [PATCH 2/2] bugfix --- models/networks/loss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/networks/loss.py b/models/networks/loss.py index b7b2c7f2..3b849b14 100644 --- a/models/networks/loss.py +++ b/models/networks/loss.py @@ -102,7 +102,7 @@ def __call__(self, input, target_is_real, for_discriminator=True): class VGGLoss(nn.Module): def __init__(self, gpu_ids): super(VGGLoss, self).__init__() - self.vgg = VGG19() if len(gpu_ids) == 0 else VGG19.cuda() + self.vgg = VGG19() if len(gpu_ids) == 0 else VGG19().cuda() self.criterion = nn.L1Loss() self.weights = [1.0 / 32, 1.0 / 16, 1.0 / 8, 1.0 / 4, 1.0]