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

Question about params in decoder #9

Open
gitlabspy opened this issue Apr 2, 2021 · 2 comments
Open

Question about params in decoder #9

gitlabspy opened this issue Apr 2, 2021 · 2 comments

Comments

@gitlabspy
Copy link

Hi, thanks for sharing your great works !!!! It's so amazing!
I have a question about the decoder, I wonder if you can help me out a bit.
Can you please explain what these three params are for? ( bias_xs, gain and bias )

vdvae/vae.py

Lines 186 to 190 in ea35b49

self.bias_xs = nn.ParameterList([nn.Parameter(torch.zeros(1, self.widths[res], res, res)) for res in self.resolutions if res <= H.no_bias_above])
self.out_net = DmolNet(H)
self.gain = nn.Parameter(torch.ones(1, H.width, 1, 1))
self.bias = nn.Parameter(torch.zeros(1, H.width, 1, 1))
self.final_fn = lambda x: x * self.gain + self.bias

@pabloppp
Copy link

pabloppp commented Apr 8, 2021

If I may try to answer...
I understand the bias_xs as a fixed initial parámeter, if you look at how the topdown block is described in the paper, you'll see that it expects a tensor as an input, and will add the conditional information from the encoder in the left branch, but in the first decoder layer there is no previous input, so we add a constant (although trainable) input that will be the same for every image (sort of how its done in StyleGAN)
Captura de Pantalla 2021-04-08 a las 11 40 18

As for bias and gain, they seem to be used to scale the output, but I am not sure why they are required since the weights & biases of the last convolution could serve the same purpose 🤔

@gitlabspy
Copy link
Author

@pabloppp Thx! Your answer did help me a lot. The shape of final scale and shift are wired, unlike normal conv/fc's params' shape...

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

2 participants