MCPcopy Create free account
hub / github.com/FireRedTeam/FireRedTTS2 / forward

Method forward

fireredtts2/codec/decoder.py:604–622  ·  view source on GitHub ↗

Args: x: shape (b, t, c) x_lens: shape (b,)

(self, x: torch.Tensor, x_lens: torch.Tensor)

Source from the content-addressed store, hash-verified

602 nn.init.constant_(m.bias, 0)
603
604 def forward(self, x: torch.Tensor, x_lens: torch.Tensor):
605 """
606 Args:
607 x: shape (b, t, c)
608 x_lens: shape (b,)
609 """
610 # Upsample
611 target_length = x.shape[1] * 2
612 x = x.transpose(1, 2)
613 x = self.upsample_conv(x)
614 x = x.transpose(1, 2)
615 # NOTE strict upsampling, trim the last 3 elements
616 x = x[:, :target_length]
617 x_lens = x_lens * 2
618 # Backbone
619 x = self.backbone(x, x_lens)
620 # iSTFT
621 y, y_lens = self.isift(x, x_lens)
622 return y, y_lens
623
624 def forward_upsample_conv_chunk(self, x: torch.Tensor, cache: torch.Tensor = None):
625 """Stream forward upsample_conv module with previous block cache.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected