(self, x)
| 277 | return torch.einsum("bix,iox->box", x, weights) |
| 278 | |
| 279 | def forward(self, x): |
| 280 | B, N, c, k = x.shape # (B, N, c, k) |
| 281 | |
| 282 | x = x.view(B, N, -1) |
| 283 | x = x.permute(0, 2, 1) |
| 284 | x_fft = torch.fft.rfft(x) |
| 285 | # Multiply relevant Fourier modes |
| 286 | l = min(self.modes1, N // 2 + 1) |
| 287 | # l = N//2+1 |
| 288 | out_ft = torch.zeros(B, c * k, N // 2 + 1, device=x.device, dtype=torch.cfloat) |
| 289 | out_ft[:, :, :l] = self.compl_mul1d(x_fft[:, :, :l], self.weights1[:, :, :l]) |
| 290 | x = torch.fft.irfft(out_ft, n=N) |
| 291 | x = x.permute(0, 2, 1).view(B, N, c, k) |
| 292 | return x |
| 293 | |
| 294 | |
| 295 | # ## |
nothing calls this directly
no test coverage detected