docstr: Helper for setting incremental state for an nn.Module.
docstr_tok: ["Helper","for","setting","incremental","state","for","an","nn.Module","."]
code: def set_incremental_state(
      self,
      incremental_state: Optional[
          Dict[str, Dict[str, Optional[Tensor]]]
      ],
      key: str,
      value: Dict[str, Optional[Tensor]],
  ) -> Optional[Dict[str, Dict[str, Optional[Tensor]]]]:
      """Helper for setting incremental state for an nn.Module."""
      if incremental_state is not None:
          full_key = self._get_full_incremental_state_key(key)
          incremental_state[full_key] = value
      return incremental_state
  
file_path: fairseq/fairseq/incremental_decoding_utils.py
imports: import uuid
  from typing import Dict, Optional
  from torch import Tensor
label_desc: Use image node_id 5 for calling the FairseqIncrementalState obj's underlying member method code with example usage: obj.set_incremental_state(incremental_state, key, value) and returns: incremental_state