DmitryUlyanov / deep-image-prior

Image restoration with neural networks but without learning.
https://dmitryulyanov.github.io/deep_image_prior
Other
7.9k stars 1.43k forks source link

Possible error in code: param_noise #67

Open simopal6 opened 5 years ago

simopal6 commented 5 years ago

In inpainting.ipynb, I don't think the following lines actually change the parameters:

for n in [x for x in net.parameters() if len(x.size()) == 4]:
            n = n + n.detach().clone().normal_() * n.std() / 50

This is the output of a similar test I've run:

>>> c = nn.Conv2d(1, 1, 1)
>>> list(c.parameters())
[Parameter containing:
tensor([[[[-0.4280]]]], requires_grad=True), Parameter containing:
tensor([0.7987], requires_grad=True)]
>>> for n in [x for x in c.parameters() if len(x.size()) == 4]:
...   n = n + 100
... 
>>> list(c.parameters())
[Parameter containing:
tensor([[[[-0.4280]]]], requires_grad=True), Parameter containing:
tensor([0.7987], requires_grad=True)]