def METHOD_NAME(
    self,
    incremental_state: Dict[str, Dict[str, Optional[Tensor]]],
    new_order: Tensor,
):
    """Main entry point for reordering the incremental state.
    Due to limitations in TorchScript, we call this function in
    :class:`fairseq.sequence_generator.SequenceGenerator` instead of
    calling :func:`reorder_incremental_state` directly.
    """
    for module in self.modules():
        if hasattr(module, "reorder_incremental_state"):
            result = module.reorder_incremental_state(incremental_state, new_order)
            if result is not None:
                incremental_state = result