encoder forward. Args: x (torch.Tensor): (batch_size, input_channels, length) Returns: x (torch.Tensor): (batch_size, encode_channels, length)
(self, x: torch.Tensor, c: torch.Tensor = None)
| 76 | self.use_tanh_at_final = use_tanh_at_final |
| 77 | |
| 78 | def forward(self, x: torch.Tensor, c: torch.Tensor = None): |
| 79 | """encoder forward. |
| 80 | |
| 81 | Args: |
| 82 | x (torch.Tensor): (batch_size, input_channels, length) |
| 83 | |
| 84 | Returns: |
| 85 | x (torch.Tensor): (batch_size, encode_channels, length) |
| 86 | """ |
| 87 | x = self.linear_pre(x.transpose(1, 2)) |
| 88 | x = self.downsample(x).transpose(1, 2) |
| 89 | x = self.vocos_backbone(x, condition=c) |
| 90 | x = self.linear(x).transpose(1, 2) |
| 91 | if self.use_tanh_at_final: |
| 92 | x = torch.tanh(x) |
| 93 | |
| 94 | return x |
| 95 | |
| 96 | |
| 97 | # test |
nothing calls this directly
no outgoing calls
no test coverage detected