UGATIT-pytorch
UGATIT-pytorch copied to clipboard
Why not set G's require_grad to False when training D for training faster and less memory?
为什么训练D的时候不把G的requires_grad设为False呢? Why not set G's require_grad to False when training D?
两次使用了下面的代码,是否可以将下面代码简化? Two times using the following code, can you simplify the following code? fake_A2A, fake_A2A_cam_logit, _ = self.genB2A(real_A) fake_B2B, fake_B2B_cam_logit, _ = self.genA2B(real_B) @znxlwm
在训练D时可以把fakeA2B和fakeB2A进行detach,这样可以省去G的梯度计算,但是训练G时是依赖D的梯度的,不能省去D的梯度计算,但是不必重新计算一次fakeA2B和fakeB2A In training D, fakeA2B and fakeB2A can be detached, so that the gradient calculation of G can be omitted; But in training G, the gradient calculation of D can not be omitted, because the gradient calculation of D is dependent on the gradient of D, but it is not necessary to recalculate fakeA2B and fakeB2A once. If I am wrong, please point out my mistake.Thanks.
为什么训练D的时候不把G的requires_grad设为False呢? Why not set G's require_grad to False when training D?
两次使用了下面的代码,是否可以将下面代码简化? Two times using the following code, can you simplify the following code? fake_A2A, fake_A2A_cam_logit, _ = self.genB2A(real_A) fake_B2B, fake_B2B_cam_logit, _ = self.genA2B(real_B)
是不是detach过数据后,require_grad就没有必要了?