(self, x: torch.Tensor, cnn_cache: torch.Tensor = None)
| 91 | return x |
| 92 | |
| 93 | def forward_chunk(self, x: torch.Tensor, cnn_cache: torch.Tensor = None): |
| 94 | if cnn_cache is None: |
| 95 | cnn_cache = x.new_zeros( |
| 96 | (x.shape[0], self.in_channels, self.causal_padding[0]) |
| 97 | ) |
| 98 | x = torch.cat([cnn_cache, x], dim=2) |
| 99 | new_cnn_cache = x[..., -self.causal_padding[0] :] |
| 100 | x = super(CausalConv1d, self).forward(x) |
| 101 | return x, new_cnn_cache |
| 102 | |
| 103 | |
| 104 | # A causal variant of ResnetBlock |