(self, x, cache_x=None)
| 39 | self.padding = (0, 0, 0) |
| 40 | |
| 41 | def forward(self, x, cache_x=None): |
| 42 | padding = list(self._padding) |
| 43 | if cache_x is not None and self._padding[4] > 0: |
| 44 | cache_x = cache_x.to(x.device) |
| 45 | # print(cache_x.shape, x.shape) |
| 46 | x = torch.cat([cache_x, x], dim=2) |
| 47 | padding[4] -= cache_x.shape[2] |
| 48 | # print('cache!') |
| 49 | x = F.pad(x, padding, mode='replicate') # mode='replicate' |
| 50 | # print(x[0,0,:,0,0]) |
| 51 | |
| 52 | return super().forward(x) |
| 53 | |
| 54 | class PixelShuffle3d(nn.Module): |
| 55 | def __init__(self, ff, hh, ww): |