Last active
October 30, 2023 07:22
-
-
Save iperov/b2735b2ab09b9bf82fb5a00ed96f4ca4 to your computer and use it in GitHub Desktop.
Latent Variables on Spheres for Autoencoders in High Dimensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pytorch implementation of | |
# Latent Variables on Spheres for Autoencoders in High Dimensions | |
# https://arxiv.org/pdf/1912.10233.pdf | |
# if implementation is wrong, please comment this gist | |
# x is (N, latent_size) | |
x = x - x.sum(-1, keepdim=True) / x.shape[-1] | |
x = x / torch.sqrt( (x**2).sum(-1, keepdim=True) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment