Skip to content

Why use narrow function when calculate Mutual Information. #7

@RachelTeamo

Description

@RachelTeamo

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions