def METHOD_NAME(
    self, models, sample: Dict[str, Dict[str, Tensor]], **kwargs
) -> List[List[Dict[str, Tensor]]]:
    """API to be invoked from :func:`~fairseq.tasks.fairseq_task.FairseqTask.inference_step()`"""
    bos_token = kwargs.get("bos_token", None)
    tokens, scores, alignments = self._generate(sample, bos_token=bos_token)
    bsz = tokens.size(0)
    # list of completed sentences
    # see :class:`~fairseq.sequence_generator.SequenceGenerator` for specifications
    finalized = torch.jit.annotate(
        List[List[Dict[str, Tensor]]],
        [torch.jit.annotate(List[Dict[str, Tensor]], []) for i in range(bsz)],
    )
    for i in range(bsz):
        finalized[i].append(
            {
                "tokens": tokens[i, :],
                "score": scores[i],
                "attention": None,
                "alignment": alignments[i, :, :]
                if self.print_alignment and alignments is not None
                else None,
            }
        )
    return finalized