class_docstr: Loads and extracts the state of an :class:`Optimizer` managed by FSDP.
class_docstr_tok: ["Loads","and","extracts","the","state","of","an",":","class",":","`","Optimizer","`","managed","by","FSDP","."]
code: def extract_state(self, stateful: Optimizer) -> Any:
      return FSDP.optim_state_dict(self.module, stateful)
  
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 3 for calling the FSDPOptimizerStateHandler obj's underlying member method code with example usage: obj.extract_state(stateful) and returns: FSDP