Exemplo n.º 1
0
def _transform_inverse(x: torch.Tensor, dim: int, duration: int):
    assert not x.requires_grad
    assert dim < 0
    dots = (slice(None), ) * (x.dim() + dim)
    left = dots + (slice(None, duration), )
    right = dots + (slice(duration, None), )
    return idct(x[right], dim)[left].add_(x[left])
Exemplo n.º 2
0
 def _inverse(self, y):
     dim = -self.event_dim
     if dim != -1:
         y = y.transpose(dim, -1)
     x = idct(y)
     if dim != -1:
         x = x.transpose(dim, -1)
     return x
Exemplo n.º 3
0
 def _inverse(self, y):
     dim = self.dim
     if dim != -1:
         y = y.transpose(dim, -1)
     if self.smooth:
         y = y / self._weight(y)
     x = idct(y)
     if dim != -1:
         x = x.transpose(dim, -1)
     return x
Exemplo n.º 4
0
def test_idct(shape):
    x = torch.randn(shape)
    actual = idct(x)
    expected = torch.from_numpy(fftpack.idct(x.numpy(), norm='ortho'))
    assert_close(actual, expected)