| 98 | return d_u, d_v |
| 99 | |
| 100 | class TriangularToeplitzMultPadded(torch.autograd.Function): |
| 101 | @staticmethod |
| 102 | def forward(ctx, u, v): |
| 103 | ctx.save_for_backward(u, v) |
| 104 | output = triangular_toeplitz_multiply_(u, v) |
| 105 | return output |
| 106 | |
| 107 | @staticmethod |
| 108 | def backward(ctx, grad): |
| 109 | u, v = ctx.saved_tensors |
| 110 | d_u = triangular_toeplitz_multiply_padded_(grad.flip(-1), v).flip(-1) |
| 111 | d_v = triangular_toeplitz_multiply_padded_(grad.flip(-1), u).flip(-1) |
| 112 | return d_u, d_v |
| 113 | |
| 114 | class TriangularToeplitzMultPaddedFast(torch.autograd.Function): |
| 115 | """ Trade off speed (20-25% faster) for more memory (20-25%) """ |
nothing calls this directly
no outgoing calls
no test coverage detected