Issue
This Content is from Stack Overflow. Question asked by Andrew Sala
In the documentation there is a little example of applying spectral norm to a linear layer and it has the norm being equal to one.
However when I apply it to a conv layer it doesn’t make the output equal to one. For example:
import torch
import torch.nn as nn
snm = nn.utils.spectral_norm(nn.Conv2d(20, 40, 3))
print(torch.linalg.matrix_norm(snm.weight, 2))
Is there something wrong with the way I implement it or am I measuring it wrong?
Solution
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.