    def compute_emissions(self, audio_input: torch.Tensor) -> torch.Tensor:
        """
        Compute the emissions for either fairseq or huggingface asr model

        Args:
            audio_path: the input audio waveform

        Returns:
            emissions: the logits of the encoded prediction.
        """

        if self.use_cuda:
            audio_input = audio_input.to("cuda")
        if isinstance(self.model, fairseq.models.wav2vec.wav2vec2_asr.Wav2VecCtc):
            padding_mask = lengths_to_padding_mask(torch.tensor([audio_input.numel()]))
            emissions = self.model.w2v_encoder(audio_input, padding_mask)[
                "encoder_out"
            ].transpose(0, 1)
        else:
            emissions = self.model(audio_input).logits

        return emissions
Compute the emissions for either fairseq or huggingface asr model

Args:
audio_path: the input audio waveform

Returns:
emissions: the logits of the encoded prediction.
examples/speech_to_speech/asr_bleu/utils.py