Skip to content

Why use narrow function when calculate Mutual Information. #7

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

Open
RachelTeamo opened this issue Jan 10, 2023 · 0 comments
Open

Why use narrow function when calculate Mutual Information. #7

RachelTeamo opened this issue Jan 10, 2023 · 0 comments

Comments

@RachelTeamo
Copy link

RachelTeamo commented Jan 10, 2023

https://github.com/sungyubkim/MINE-Mutual-Information-Neural-Estimation-/blob/master/GAN_VDB_MINE.ipynb
In the above url In [11]. the code:
`

    z = torch.narrow(z, dim=1, start=0, length=3) # slice for MI 

    mi = torch.mean(M(z, x_tilde)) - torch.log(torch.mean(torch.exp(M(z_bar, x_tilde)))+1e-8)

    loss -= 0.01 * mi

`
Since z is a gaussian distribution, the dimensional of z is [B, feature_dim], and x_tilde is the output of the Generator network. When we calculate Mutual Information of them, we use the above code. I wonder why we use the narrow function and what is purpose of it. Meanwhile, I also wonder why the length=3, why we use 3 instead of the feature_dim of z.
Thanks!

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

1 participant