(ctx, u, v)
| 71 | class TriangularToeplitzMultFast(torch.autograd.Function): |
| 72 | @staticmethod |
| 73 | def forward(ctx, u, v): |
| 74 | n = u.shape[-1] |
| 75 | u_expand = F.pad(u, (0, n)) |
| 76 | v_expand = F.pad(v, (0, n)) |
| 77 | u_f = torch.fft.rfft(u_expand, n=2*n, dim=-1) |
| 78 | v_f = torch.fft.rfft(v_expand, n=2*n, dim=-1) |
| 79 | |
| 80 | ctx.save_for_backward(u_f, v_f) |
| 81 | |
| 82 | uv_f = u_f * v_f |
| 83 | output = torch.fft.irfft(uv_f, n=2*n, dim=-1)[..., :n] |
| 84 | return output |
| 85 | |
| 86 | @staticmethod |
| 87 | def backward(ctx, grad): |
nothing calls this directly
no outgoing calls
no test coverage detected