diff options
| author | Jun-Yan Zhu <junyanz@users.noreply.github.com> | 2018-01-14 20:51:15 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-14 20:51:15 -0500 |
| commit | 7ed6fac6cee515ca8868becb6bda37786563ea96 (patch) | |
| tree | 84b8dec95920763a8afaff11ae04255066f29fa7 /models/cycle_gan_model.py | |
| parent | beed9ba76a88da7bb4fe09094fe6e175f6b2d0de (diff) | |
| parent | 1c5c2f50da5ae101077c27fdac2a12fb1619ec86 (diff) | |
Merge pull request #187 from SsnL/resize_
Fix resize_ issue #170
Diffstat (limited to 'models/cycle_gan_model.py')
| -rw-r--r-- | models/cycle_gan_model.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/models/cycle_gan_model.py b/models/cycle_gan_model.py index fe06823..b7b840d 100644 --- a/models/cycle_gan_model.py +++ b/models/cycle_gan_model.py @@ -20,8 +20,6 @@ class CycleGANModel(BaseModel): nb = opt.batchSize size = opt.fineSize - self.input_A = self.Tensor(nb, opt.input_nc, size, size) - self.input_B = self.Tensor(nb, opt.output_nc, size, size) # load/define networks # The naming conversion is different from those used in the paper @@ -81,8 +79,11 @@ class CycleGANModel(BaseModel): AtoB = self.opt.which_direction == 'AtoB' input_A = input['A' if AtoB else 'B'] input_B = input['B' if AtoB else 'A'] - self.input_A.resize_(input_A.size()).copy_(input_A) - self.input_B.resize_(input_B.size()).copy_(input_B) + if len(self.gpu_ids) > 0: + input_A = input_A.cuda(self.gpu_ids[0], async=True) + input_B = input_B.cuda(self.gpu_ids[0], async=True) + self.input_A = input_A + self.input_B = input_B self.image_paths = input['A_paths' if AtoB else 'B_paths'] def forward(self): |
