nathanaelbosch / generative-latent-optimization

PyTorch Implementation: "Optimizing the Latent Space of Generative Networks"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Choice of Z by projection on unit sphere

philippwulff opened this issue · comments

Hi, I know this project is a bit older, but I just read this part in the original paper and am kind of confused by it:

Screenshot 2022-12-02 at 15 13 35

I saw that you are projecting the Z vectors on the L2 unit sphere during initialisation (although you commented it out), but are you also doing it after every GLO update? I could not find that piece of code. Also, do you know what is the intuition behind doing this?

This is in model.py on line 13:

def _project_to_l2_ball(z):
    # return z / np.maximum(np.sqrt(np.sum(z**2, axis=1))[:, None], 1)
    # return z / np.sqrt(np.sum(z**2, axis=1))[:, None]
    # return z / np.max(np.sqrt(np.sum(z**2, axis=1))[:, None])
    return z

Thank you :)