Skip to content

parameter may be not registered #2

Description

@DrRyanHuang

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)])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions