examples/research_projects/onnx/summarization/bart_onnx/generation_onnx.py/BARTBeamSearchGenerator/_reorder_cache
class BARTBeamSearchGenerator:    def _reorder_cache(self, past: List[torch.Tensor], beam_idx):
        # if decoder past is not included in output
        # speedy decoding is disabled and no need to reorder
        reordered_decoder_past = []
        for state in past:
            reordered_decoder_past.append(state.index_select(0, beam_idx))
        return reordered_decoder_past