(self, c: Config)
| 429 | use_weight_norm: bool = False |
| 430 | |
| 431 | def __init__(self, c: Config): |
| 432 | super().__init__() |
| 433 | |
| 434 | self.proj_in = nn.Linear(c.dim, c.latent_dim * 2, bias=c.bias) |
| 435 | self.proj_out = nn.Linear(c.latent_dim, c.dim, bias=c.bias) |
| 436 | |
| 437 | if c.use_weight_norm: |
| 438 | self.proj_in = weight_norm(self.proj_in) |
| 439 | self.proj_out = weight_norm(self.proj_out) |
| 440 | |
| 441 | def reparam(self, mu, logvar): |
| 442 | std = T.exp(logvar / 2) |