class_docstr: Holds a collection of stateful objects.
class_docstr_tok: ["Holds","a","collection","of","stateful","objects","."]
docstr: Add ``obj`` to the bag, but do not preserve its state in ``state_dict``.
  
  :param name:
      The attribute name to refer to ``obj``.
  :param obj:
      The object to add.
docstr_tok: ["Add","``","obj","``","to","the","bag",",","but","do","not","preserve","its","state","in","``","state_dict","``",".",":","param","name",":","The","attribute","name","to","refer","to","``","obj","``",".",":","param","obj",":","The","object","to","add","."]
code: def register_non_stateful(self, name: str, obj: Any) -> None:
      """Add ``obj`` to the bag, but do not preserve its state in ``state_dict``.
  
      :param name:
          The attribute name to refer to ``obj``.
      :param obj:
          The object to add.
      """
      if hasattr(self, name):
          raise AttributeError(
              f"`{type(self).__name__}` object already has an attribute '{name}'."
          )
  
      super().__setattr__(name, obj)
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from typing import Any, Dict, Mapping, Optional, Protocol, Tuple, final, runtime_checkable
  from torch.distributed.fsdp import FullyShardedDataParallel
  from torch.nn import Module
  from torch.optim import Optimizer
  from fairseq2.typing import finaloverride
label_desc: Use image node_id 6 for calling the StatefulObjectBag obj's underlying member method code with example usage: obj.register_non_stateful(name, obj) without return types