Args: x: [..., x_dim] Returns: latent: [..., latent_dim]
(self, x: torch.Tensor)
| 24 | ) * self.x_dim |
| 25 | |
| 26 | def forward(self, x: torch.Tensor) -> torch.Tensor: |
| 27 | """ |
| 28 | Args: |
| 29 | x: [..., x_dim] |
| 30 | Returns: |
| 31 | latent: [..., latent_dim] |
| 32 | """ |
| 33 | if self.max_deg == self.min_deg: |
| 34 | return x |
| 35 | xb = torch.reshape( |
| 36 | (x[Ellipsis, None, :] * self.scales[:, None]), |
| 37 | list(x.shape[:-1]) + [(self.max_deg - self.min_deg) * self.x_dim], |
| 38 | ) |
| 39 | latent = torch.sin(torch.cat([xb, xb + 0.5 * math.pi], dim=-1)) |
| 40 | if self.use_identity: |
| 41 | latent = torch.cat([x] + [latent], dim=-1) |
| 42 | return latent |
| 43 | |
| 44 | |
| 45 | class DecoderMLP(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected