class_docstr: Holds submodules in a list.
  
  This class extends :class:`torch.nn.ModuleList` with an extra feature that
  optionally drops a random number of submodules at every iteration during
  training.
  
  Usage:
  
  >>> from torch.nn import Module
  >>>
  >>> from fairseq2.nn import ModuleList
  >>>
  >>> layer1 = Module()
  >>> layer2 = Module()
  >>> layer3 = Module()
  >>>
  >>> layers = ModuleList([layer1, layer2, layer3], drop_p=0.5)
  >>>
  >>> for layer in layers.drop_iter():  # This might iterate over layers 1 and 3.
  ...    x = layer(x)
  >>> for layer in layers.drop_iter():  # This might iterate over all layers.
  ...    x = layer(x)
  >>> for layer in layers.drop_iter():  # This might not iterate over any layers.
  ...    x = layer(x)
docstr: :meta private:
docstr_tok: [":","meta","private",":"]
code: def extra_repr(self) -> str:
      """:meta private:"""
      s = super().extra_repr()
  
      if self.drop_p > 0.0:
          s = f"{s}, drop_p={self.drop_p}"
  
      return s
  
file_path: fairseq2/src/fairseq2/nn/module_list.py
imports: from typing import Iterable, Iterator, Optional, final
  import torch
  from torch.nn import Module
  from torch.nn import ModuleList
  from fairseq2.typing import CPU
label_desc: Use image node_id 3 for calling the ModuleList obj's underlying member method code with example usage: obj.extra_repr() and returns: s