MCPcopy Create free account
hub / github.com/Sin3DM/Sin3DM / forward

Method forward

src/encoding/blocks.py:26–42  ·  view source on GitHub ↗

Args: x: [..., x_dim] Returns: latent: [..., latent_dim]

(self, x: torch.Tensor)

Source from the content-addressed store, hash-verified

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
45class DecoderMLP(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected