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 Mu/Log Variance to Latent code #10

Open
mtkmark opened this issue Nov 28, 2017 · 1 comment
Open

Question about Mu/Log Variance to Latent code #10

mtkmark opened this issue Nov 28, 2017 · 1 comment

Comments

@mtkmark
Copy link

mtkmark commented Nov 28, 2017

The following section contains the math of latent code generation.
Where can we find " what exact math operation does it perform " ?

Thanks

def reparameterize(self, mu, logvar):
    if self.training:
      std = logvar.mul(0.5).exp_()
      eps = Variable(std.data.new(std.size()).normal_())

===

@hui-po-wang
Copy link
Contributor

Hi @mtkmark,

I am not sure if I have your question right, but let me make a guess....

According to two pictures below, the first figure shows that we should draw some noise from standard normal, and multiply it by standard deviation and add mean to it, and in the sample codes, they indeed return values based on the operation. This is so-called reparameterization.

To achieve the goal, we first compute the standard deviation (For the reason why we can compute it by logvar.mul(0.5).exp_(), please refer to the question I answered before #9). As we get the standard deviation, we should draw some noise from normal distribution of which dimension is equal to the dim. of the standard deviation (also equal to the dim. of mean. It's straightforward because each normal distribution has one var and one mean as its parameters. In our case, it should be 10.) In the end, the function shown in the second figure returns the reparameterized noise.

screenshot from 2017-11-28 10-30-02
screenshot from 2017-11-28 10-33-45

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