|
self.rs = [ResidualBlock(64, use_cuda=use_cuda) for i in range(4)] |
|
self.up = [UpsampleBlock(64, use_cuda=use_cuda) for i in range(2)] |
|
self.rs = [ResidualBlock(64, use_cuda=use_cuda) for i in range(4)] |
I dont know PyTorch of old version. However, code above may be wrong with PyTorch 1.6+, because the parameters could not be registered. The forward propagation can run, but parameter may be not updated on the backward propagation. Thus the loss will be oscillating and not decrease.
It should be like this:
https://github.com/DrRyanHuang/SuperResolution/blob/42b230d5877d5c8f0d5e07dda8ad63edcf5e2a70/model.py#L102
if upblock:
# Loop for residual blocks
self.rs = nn.ModuleList([ResidualBlock(64, device=device) for i in range(4)])
# Loop for upsampling
self.up = nn.ModuleList([UpsampleBlock(64, device=device) for i in range(2)])
else:
# Loop for residual blocks
self.rs = nn.ModuleList([ResidualBlock(64, device=device) for i in range(4)])
SuperResolution/model.py
Line 118 in 7c88843
SuperResolution/model.py
Line 120 in 7c88843
SuperResolution/model.py
Line 123 in 7c88843
I dont know PyTorch of old version. However, code above may be wrong with PyTorch 1.6+, because the parameters could not be registered. The forward propagation can run, but parameter may be not updated on the backward propagation. Thus the loss will be oscillating and not decrease.
It should be like this:
https://github.com/DrRyanHuang/SuperResolution/blob/42b230d5877d5c8f0d5e07dda8ad63edcf5e2a70/model.py#L102