MCPcopy Create free account
hub / github.com/SparkAudio/Spark-TTS / forward

Method forward

sparktts/modules/encoder_decoder/feat_decoder.py:78–94  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected