src/transformers/models/encoder_decoder/modeling_encoder_decoder.py/EncoderDecoderModel/_reorder_cache
class EncoderDecoderModel:    def _reorder_cache(self, past, beam_idx):
        # apply decoder cache reordering here
        return self.decoder._reorder_cache(past, beam_idx)