MCPcopy Create free account
hub / github.com/HazyResearch/spacetime / forward

Method forward

model/functional/toeplitz.py:73–84  ·  view source on GitHub ↗
(ctx, u, v)

Source from the content-addressed store, hash-verified

71class 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):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected