diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-08-08 19:59:55 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-08-08 19:59:55 +0200 |
commit | 240f5e9f20032e82515fa66ce784619527d1041e (patch) | |
tree | b002d28bbfc9abe9b6af090f7db60bea0aeed6e8 /text_recognizer/networks/vqvae/norm.py | |
parent | d12f70402371dda586d457af2a3df7fb5b3130ad (diff) |
Add VQGAN and loss function
Diffstat (limited to 'text_recognizer/networks/vqvae/norm.py')
-rw-r--r-- | text_recognizer/networks/vqvae/norm.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/text_recognizer/networks/vqvae/norm.py b/text_recognizer/networks/vqvae/norm.py index 3e6963a..d73f9f8 100644 --- a/text_recognizer/networks/vqvae/norm.py +++ b/text_recognizer/networks/vqvae/norm.py @@ -6,13 +6,17 @@ from torch import nn, Tensor @attr.s(eq=False) class Normalize(nn.Module): num_channels: int = attr.ib() + num_groups: int = attr.ib(default=32) norm: nn.GroupNorm = attr.ib(init=False) def __attrs_post_init__(self) -> None: """Post init configuration.""" super().__init__() self.norm = nn.GroupNorm( - num_groups=self.num_channels, num_channels=self.num_channels, eps=1.0e-6, affine=True + num_groups=self.num_groups, + num_channels=self.num_channels, + eps=1.0e-6, + affine=True, ) def forward(self, x: Tensor) -> Tensor: |