Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parameter may be not registered #2

Open
DrRyanHuang opened this issue Jan 12, 2021 · 0 comments
Open

parameter may be not registered #2

DrRyanHuang opened this issue Jan 12, 2021 · 0 comments

Comments

@DrRyanHuang
Copy link

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)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant