def forward(self, model, sample, reduce=True):
        """Compute the loss for the given sample.

        Returns a tuple with three elements:
        1) the loss
        2) the sample size, which is used as the denominator for the gradient
        3) logging outputs to display while training
        """

        task_name = sample['task_name']
        if task_name == 's2t' or task_name == 's2c':
            return self.text_criterion(model, sample, reduce)
        elif task_name == 't2s' or task_name == 's2s':
            return self.speech_criterion(model, sample)
        elif task_name == 'text_pretrain':
            return self.text_pretrain_criterion(model, sample, reduce)
        elif task_name == 'speech_pretrain':
            return self.speech_pretrain_criterion(model, sample, reduce)
Compute the loss for the given sample.

        Returns a tuple with three elements:
        1) the loss
        2) the sample size, which is used as the denominator for the gradient
        3) logging outputs to display while training
        
speecht5/speecht5/criterions/speecht5_criterion.py