(self, x)
| 487 | return torch.einsum(order, x.real, weights.real) |
| 488 | |
| 489 | def forward(self, x): |
| 490 | B, N, c, k = x.shape # (B, N, c, k) |
| 491 | |
| 492 | x = x.view(B, N, -1) |
| 493 | x = x.permute(0, 2, 1) |
| 494 | x_fft = torch.fft.rfft(x) |
| 495 | # Multiply relevant Fourier modes |
| 496 | l = min(self.modes1, N // 2 + 1) |
| 497 | out_ft = torch.zeros(B, c * k, N // 2 + 1, device=x.device, dtype=torch.cfloat) |
| 498 | out_ft[:, :, :l] = self.compl_mul1d("bix,iox->box", x_fft[:, :, :l], |
| 499 | torch.complex(self.weights1, self.weights2)[:, :, :l]) |
| 500 | x = torch.fft.irfft(out_ft, n=N) |
| 501 | x = x.permute(0, 2, 1).view(B, N, c, k) |
| 502 | return x |
| 503 | |
| 504 | |
| 505 | # ## |
nothing calls this directly
no test coverage detected