class_docstr: Holds the module states during incremental decoding.
class_docstr_tok: ["Holds","the","module","states","during","incremental","decoding","."]
docstr: :param max_num_steps:
      The expected maximum number of steps to take.
  :param capacity_increment:
      The sequence length capacity of state tensors will be incremented by
      multiples of this value. If ``None``, state tensors will be
      preallocated with a capacity of ``max_num_steps``.
docstr_tok: [":","param","max_num_steps",":","The","expected","maximum","number","of","steps","to","take",".",":","param","capacity_increment",":","The","sequence","length","capacity","of","state","tensors","will","be","incremented","by","multiples","of","this","value",".","If","``","None","``",",","state","tensors","will","be","preallocated","with","a","capacity","of","``","max_num_steps","``","."]
code: def __init__(
      self,
      max_num_steps: int,
      *,
      capacity_increment: Optional[int] = 16,
  ) -> None:
      """
      :param max_num_steps:
          The expected maximum number of steps to take.
      :param capacity_increment:
          The sequence length capacity of state tensors will be incremented by
          multiples of this value. If ``None``, state tensors will be
          preallocated with a capacity of ``max_num_steps``.
      """
      if capacity_increment is not None and capacity_increment < 1:
          raise ValueError(
              f"`capacity_increment` must be greater than or equal to 1, but is {capacity_increment} instead."
          )
  
      self.step_nr = 0
      self.max_num_steps = max_num_steps
      self.capacity_increment = capacity_increment
  
      self._module_states = {}
  
file_path: fairseq2/src/fairseq2/nn/incremental_state.py
imports: from abc import ABC, abstractmethod
  from typing import Dict, Optional, Type, TypeVar
  from torch import Tensor
  from torch.nn import Module
label_desc: Use image node_id 1 to create a new IncrementalStateBag object  with example: obj = IncrementalStateBag(max_num_steps)