def rnnt_decoder_predictions_tensor(self, encoder_output: torch.Tensor, encoded_lengths: torch.Tensor, return_hypotheses: bool=False) -> (List[str], Optional[List[List[str]]], Optional[Union[(Hypothesis, NBestHypotheses)]]):
    '\n        Decode an encoder output by autoregressive decoding of the Decoder+Joint networks.\n\n        Args:\n            encoder_output: torch.Tensor of shape [B, D, T].\n            encoded_lengths: torch.Tensor containing lengths of the padded encoder outputs. Shape [B].\n            return_hypotheses: bool. If set to True it will return list of Hypothesis or NBestHypotheses\n\n        Returns:\n            If `return_best_hypothesis` is set:\n                A tuple (hypotheses, None):\n                hypotheses - list of Hypothesis (best hypothesis per sample).\n                    Look at rnnt_utils.Hypothesis for more information.\n\n            If `return_best_hypothesis` is not set:\n                A tuple(hypotheses, all_hypotheses)\n                hypotheses - list of Hypothesis (best hypothesis per sample).\n                    Look at rnnt_utils.Hypothesis for more information.\n                all_hypotheses - list of NBestHypotheses. Each NBestHypotheses further contains a sorted\n                    list of all the hypotheses of the model per sample.\n                    Look at rnnt_utils.NBestHypotheses for more information.\n        '
    with torch.no_grad():
        hypotheses_list = self.decoding(encoder_output=encoder_output, encoded_lengths=encoded_lengths)
        hypotheses_list = hypotheses_list[0]
    prediction_list = hypotheses_list
    if isinstance(prediction_list[0], NBestHypotheses):
        hypotheses = []
        all_hypotheses = []
        for nbest_hyp in prediction_list:
            n_hyps = nbest_hyp.n_best_hypotheses
            decoded_hyps = self.decode_hypothesis(n_hyps)
            hypotheses.append(decoded_hyps[0])
            all_hypotheses.append(decoded_hyps)
        if return_hypotheses:
            return (hypotheses, all_hypotheses)
        best_hyp_text = [h.text for h in hypotheses]
        all_hyp_text = [h.text for hh in all_hypotheses for h in hh]
        return (best_hyp_text, all_hyp_text)
    else:
        hypotheses = self.decode_hypothesis(prediction_list)
        if return_hypotheses:
            return (hypotheses, None)
        best_hyp_text = [h.text for h in hypotheses]
        return (best_hyp_text, None)
Decode an encoder output by autoregressive decoding of the Decoder+Joint networks.

Args:
    encoder_output: torch.Tensor of shape [B, D, T].
    encoded_lengths: torch.Tensor containing lengths of the padded encoder outputs. Shape [B].
    return_hypotheses: bool. If set to True it will return list of Hypothesis or NBestHypotheses

Returns:
    If `return_best_hypothesis` is set:
        A tuple (hypotheses, None):
        hypotheses - list of Hypothesis (best hypothesis per sample).
            Look at rnnt_utils.Hypothesis for more information.

    If `return_best_hypothesis` is not set:
        A tuple(hypotheses, all_hypotheses)
        hypotheses - list of Hypothesis (best hypothesis per sample).
            Look at rnnt_utils.Hypothesis for more information.
        all_hypotheses - list of NBestHypotheses. Each NBestHypotheses further contains a sorted
            list of all the hypotheses of the model per sample.
            Look at rnnt_utils.NBestHypotheses for more information.
def rnnt_decoder_predictions_tensor(self, encoder_output: torch.Tensor, encoded_lengths: torch.Tensor, return_hypotheses: bool=False) -> (List[str], Optional[List[List[str]]], Optional[Union[(Hypothesis, NBestHypotheses)]]):
    '\n        Decode an encoder output by autoregressive decoding of the Decoder+Joint networks.\n\n        Args:\n            encoder_output: torch.Tensor of shape [B, D, T].\n            encoded_lengths: torch.Tensor containing lengths of the padded encoder outputs. Shape [B].\n            return_hypotheses: bool. If set to True it will return list of Hypothesis or NBestHypotheses\n\n        Returns:\n            If `return_best_hypothesis` is set:\n                A tuple (hypotheses, None):\n                hypotheses - list of Hypothesis (best hypothesis per sample).\n                    Look at rnnt_utils.Hypothesis for more information.\n\n            If `return_best_hypothesis` is not set:\n                A tuple(hypotheses, all_hypotheses)\n                hypotheses - list of Hypothesis (best hypothesis per sample).\n                    Look at rnnt_utils.Hypothesis for more information.\n                all_hypotheses - list of NBestHypotheses. Each NBestHypotheses further contains a sorted\n                    list of all the hypotheses of the model per sample.\n                    Look at rnnt_utils.NBestHypotheses for more information.\n        '
    with torch.no_grad():
        hypotheses_list = self.decoding(encoder_output=encoder_output, encoded_lengths=encoded_lengths)
        hypotheses_list = hypotheses_list[0]
    prediction_list = hypotheses_list
    if isinstance(prediction_list[0], NBestHypotheses):
        hypotheses = []
        all_hypotheses = []
        for nbest_hyp in prediction_list:
            n_hyps = nbest_hyp.n_best_hypotheses
            decoded_hyps = self.decode_hypothesis(n_hyps)
            hypotheses.append(decoded_hyps[0])
            all_hypotheses.append(decoded_hyps)
        if return_hypotheses:
            return (hypotheses, all_hypotheses)
        best_hyp_text = [h.text for h in hypotheses]
        all_hyp_text = [h.text for hh in all_hypotheses for h in hh]
        return (best_hyp_text, all_hyp_text)
    else:
        hypotheses = self.decode_hypothesis(prediction_list)
        if return_hypotheses:
            return (hypotheses, None)
        best_hyp_text = [h.text for h in hypotheses]
        return (best_hyp_text, None)