From 668cafa798670e0f52b709f47c818efcb4edc256 Mon Sep 17 00:00:00 2001 From: James Betker Date: Sun, 18 Oct 2020 22:39:52 -0600 Subject: [PATCH] Push correct patch of recurrent embedding to upstream image, rather than whole thing --- codes/models/steps/progressive_zoom.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/codes/models/steps/progressive_zoom.py b/codes/models/steps/progressive_zoom.py index f7661af8..c516e0bb 100644 --- a/codes/models/steps/progressive_zoom.py +++ b/codes/models/steps/progressive_zoom.py @@ -85,9 +85,12 @@ class ProgressiveGeneratorInjector(Injector): recurrent_hq = base_hq_out recurrent = base_recurrent for link in chain: # Remember, `link` is a MultiscaleTreeNode. + top = int(link.top * h) + left = int(link.left * w) + recurrent = torch.nn.functional.interpolate(recurrent[:, :, top:top+h//2, left:left+w//2], scale_factor=2, mode="nearest") if self.feed_gen_output_into_input: - top = int(link.top * 2 * h) - left = int(link.left * 2 * w) + top *= 2 + left *= 2 lq_input = recurrent_hq[:, :, top:top+h, left:left+w] else: lq_input = lq_inputs[:, link.index]