def METHOD_NAME(
    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)