Args: x: (..., d).
(self, x)
| 33 | return in_dim * (2 * self.num_funcs + 1) |
| 34 | |
| 35 | def forward(self, x): |
| 36 | """ |
| 37 | Args: |
| 38 | x: (..., d). |
| 39 | """ |
| 40 | shape = list(x.shape[:-1]) + [-1] |
| 41 | x = x.unsqueeze(-1) # (..., d, 1) |
| 42 | code = torch.cat([x, torch.sin(x * self.freq_bands), torch.cos(x * self.freq_bands)], dim=-1) # (..., d, 2f+1) |
| 43 | code = code.reshape(shape) |
| 44 | return code |
| 45 | |
| 46 | |
| 47 |
nothing calls this directly
no outgoing calls
no test coverage detected