docstr: Reorder incremental state.
  
  This will be called when the order of the input has changed from the
  previous time step. A typical use case is beam search, where the input
  order changes between time steps based on the selection of beams.
docstr_tok: ["Reorder","incremental","state",".","This","will","be","called","when","the","order","of","the","input","has","changed","from","the","previous","time","step",".","A","typical","use","case","is","beam","search",",","where","the","input","order","changes","between","time","steps","based","on","the","selection","of","beams","."]
code: def reorder_incremental_state(
      self,
      incremental_state: Dict[str, Dict[str, Optional[torch.Tensor]]],
      new_order: torch.Tensor,
  ):
      """Reorder incremental state.
  
      This will be called when the order of the input has changed from the
      previous time step. A typical use case is beam search, where the input
      order changes between time steps based on the selection of beams.
      """
      raise NotImplementedError(
          "This is required for generation/beam search"
      )
  
imports: import logging
  from dataclasses import dataclass
  from typing import Dict, List, Optional
  import torch
  from fairseq.dataclass import FairseqDataclass
  from fairseq.models import FairseqIncrementalDecoder, FairseqLanguageModel, register_model
  from .adaptive_span_model import TransformerSeq
label_desc: Use image node_id 8 for calling the AdaptiveSpanDecoder obj's underlying member method code with example usage: obj.reorder_incremental_state(incremental_state, new_order) without return types