    def forward(self, data):
        """VitsSVC forward function.

        Args:
            data (dict): condition data & audio data, including:
            B: batch size, T: target length
            {
                "spk_id": [B, singer_table_size]
                "target_len": [B]
                "mask": [B, T, 1]
                "mel": [B, T, n_mel]
                "linear": [B, T, n_fft // 2 + 1]
                "frame_pitch": [B, T]
                "frame_uv": [B, T]
                "audio": [B, audio_len]
                "audio_len": [B]
                "contentvec_feat": [B, T, contentvec_dim]
                "whisper_feat": [B, T, whisper_dim]
                ...
            }
        """

        # TODO: elegantly handle the dimensions
        spec = data["linear"].transpose(1, 2)

        g = data["spk_id"]
        g = self.emb_g(g).transpose(1, 2)

        c_lengths = data["target_len"]
        spec_lengths = data["target_len"]
        f0 = data["frame_pitch"]

        # condition_encoder ver.
        x = self.condition_encoder(data).transpose(1, 2)
        x_mask = torch.unsqueeze(sequence_mask(c_lengths, f0.size(1)), 1).to(x.dtype)

        # prior encoder
        z_ptemp, m_p, logs_p, _ = self.enc_p(x, x_mask)
        # posterior encoder
        z, m_q, logs_q, spec_mask = self.enc_q(spec, spec_lengths, g=g)

        # flow
        z_p = self.flow(z, spec_mask, g=g)
        z_slice, pitch_slice, ids_slice = rand_slice_segments_with_pitch(
            z, f0, spec_lengths, self.segment_size
        )

        if self.dec_name == "nsfhifigan":
            o = self.dec(z_slice, f0=f0.float())
        elif self.dec_name == "apnet":
            _, _, _, _, o = self.dec(z_slice)
        else:
            o = self.dec(z_slice)

        outputs = {
            "y_hat": o,
            "ids_slice": ids_slice,
            "x_mask": x_mask,
            "z_mask": data["mask"].transpose(1, 2),
            "z": z,
            "z_p": z_p,
            "m_p": m_p,
            "logs_p": logs_p,
            "m_q": m_q,
            "logs_q": logs_q,
        }
        return outputs
VitsSVC forward function.

Args:
data (dict): condition data & audio data, including:
B: batch size, T: target length
{
"spk_id": [B, singer_table_size]
"target_len": [B]
"mask": [B, T, 1]
"mel": [B, T, n_mel]
"linear": [B, T, n_fft // 2 + 1]
"frame_pitch": [B, T]
"frame_uv": [B, T]
"audio": [B, audio_len]
"audio_len": [B]
"contentvec_feat": [B, T, contentvec_dim]
"whisper_feat": [B, T, whisper_dim]
...
}
models/svc/vits/vits.py