Download RES4LYF/lightricks/vae/pixel_norm.py from MarkLilly/mis-custom-nodes: direct link, hf CLI and curl.
- Browser
- Download file 319 Bytes
-
https://huggingface.co/MarkLilly/mis-custom-nodes/resolve/main/RES4LYF/lightricks/vae/pixel_norm.py
- Command line
-
hf download hf://MarkLilly/mis-custom-nodes/RES4LYF/lightricks/vae/pixel_norm.py
-
curl -L -o pixel_norm.py https://huggingface.co/MarkLilly/mis-custom-nodes/resolve/main/RES4LYF/lightricks/vae/pixel_norm.py
319 Bytes
| import torch | |
| from torch import nn | |
| class PixelNorm(nn.Module): | |
| def __init__(self, dim=1, eps=1e-8): | |
| super(PixelNorm, self).__init__() | |
| self.dim = dim | |
| self.eps = eps | |
| def forward(self, x): | |
| return x / torch.sqrt(torch.mean(x**2, dim=self.dim, keepdim=True) + self.eps) | |