class_docstr: This contains the data structures to track the execution order. We track
  the pre-forward order on the *first* iteration for forward prefetching
  (which thus assumes static graph) and the post-forward order on *every*
  iteration for backward prefetching (which thus does not assume static
  graph but may be provide an incorrect order).
docstr: Records ``handles`` in the pre-forward order, where ``handles`` should
  be a group of handles used in the same module's forward. If ``handles``
  is empty, then it is omitted.
  
  On the first iteration, this checks the execution order across ranks.
  See :meth:`_check_order` for details.
docstr_tok: ["Records","``","handles","``","in","the","pre-forward","order",",","where","``","handles","``","should","be","a","group","of","handles","used","in","the","same","module","'s","forward",".","If","``","handles","``","is","empty",",","then","it","is","omitted",".","On","the","first","iteration",",","this","checks","the","execution","order","across","ranks",".","See",":","meth",":","`","_check_order","`","for","details","."]
code: def record_pre_forward(
      self, handle: Optional[FlatParamHandle], is_training: bool
  ) -> None:
      """
      Records ``handles`` in the pre-forward order, where ``handles`` should
      be a group of handles used in the same module's forward. If ``handles``
      is empty, then it is omitted.
  
      On the first iteration, this checks the execution order across ranks.
      See :meth:`_check_order` for details.
      """
      if not handle:
          return
      self._check_order(handle, is_training)
      # Fix the order after the first iteration and only record the first
      # usage of a handles key
      if (
          not self.is_first_iter
          or handle._pre_forward_order_index is not None
      ):
          return
      index = len(self.handles_pre_forward_order)
      handle._pre_forward_order_index = index
      self.handles_pre_forward_order.append(handle)
  
imports: import itertools
  import warnings
  from enum import auto, Enum
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  import torch.distributed
  import torch.distributed.fsdp._traversal_utils
  import torch.nn
  from torch.distributed.fsdp._common_utils import _FSDPState, _get_param_to_fqns
  from torch.distributed.fsdp._flat_param import FlatParamHandle
label_desc: Use image node_id 7 for calling the _ExecOrderData obj's underlying member method code with example usage: obj.record_pre_forward(handle, is_training) without return types