code: def prune_incremental_state(
      self,
      incremental_state: Optional[
          Dict[str, Dict[str, Optional[Tensor]]]
      ],
  ):
      input_buffer = self.self_attn._get_input_buffer(incremental_state)
      for key in ["prev_key", "prev_value"]:
          input_buffer_key = input_buffer[key]
          assert input_buffer_key is not None
          if input_buffer_key.size(2) > 1:
              input_buffer[key] = input_buffer_key[:, :, :-1, :]
          else:
              typed_empty_dict: Dict[str, Optional[Tensor]] = {}
              input_buffer = typed_empty_dict
              break
      assert incremental_state is not None
      self.self_attn._set_input_buffer(incremental_state, input_buffer)
  
file_path: fairseq/examples/simultaneous_translation/modules/monotonic_transformer_layer.py
imports: from fairseq.modules import TransformerDecoderLayer, TransformerEncoderLayer
  from .None import build_monotonic_attention
  from typing import Dict, Optional, List
  from torch import Tensor
  import torch
label_desc: Use image node_id 2 for calling the TransformerMonotonicDecoderLayer obj's underlying member method code with example usage: obj.prune_incremental_state(incremental_state) without return types