class_docstr: Default data parallel wrapper, which applies data parallel to all unsharded modules.
class_docstr_tok: ["Default","data","parallel","wrapper",",","which","applies","data","parallel","to","all","unsharded","modules","."]
code: def _ddp_wrap(
      self,
      dmp: "DistributedModelParallel",
      env: ShardingEnv,
      device: torch.device,
      ddp_ignore_param_names: Set[str],
  ) -> None:
      pg = env.process_group
      if pg is None:
          raise RuntimeError(
              "Can only init DDP for ProcessGroup-based ShardingEnv"
          )
      all_parameter_names = set(dict(dmp.named_parameters()).keys())
      if len(all_parameter_names - ddp_ignore_param_names) == 0:
          return
      DistributedDataParallel._set_params_and_buffers_to_ignore_for_model(
          module=dmp._dmp_wrapped_module,
          params_and_buffers_to_ignore=ddp_ignore_param_names,
      )
      # initialize DDP
      dmp._dmp_wrapped_module = cast(
          nn.Module,
          DistributedDataParallel(
              module=dmp._dmp_wrapped_module.to(device),
              device_ids=None if device.type == "cpu" else [device],
              process_group=pg,
              gradient_as_bucket_view=True,
              broadcast_buffers=False,
              static_graph=self._static_graph,
              find_unused_parameters=self._find_unused_parameters,
              bucket_cap_mb=self._bucket_cap_mb,
          ),
      )
      if self._allreduce_comm_precision == "fp16":
          dmp._dmp_wrapped_module.register_comm_hook(
              None, ddp_default_hooks.fp16_compress_hook
          )
      elif self._allreduce_comm_precision == "bf16":
          dmp._dmp_wrapped_module.register_comm_hook(
              None, ddp_default_hooks.bf16_compress_hook
          )
  
imports: import abc
  import copy
  from collections import OrderedDict
  from typing import Any, cast, Dict, Iterator, List, Optional, Set, Tuple, Type
  import torch
  import torch.distributed
  from torch import nn
  from torch.distributed.algorithms.ddp_comm_hooks import default_hooks
  from torch.distributed.fsdp import FullyShardedDataParallel
  from torch.nn.modules.module import _IncompatibleKeys
  from torch.nn.parallel import DistributedDataParallel
  from torchrec.distributed.comm import get_local_size
  from torchrec.distributed.planner import EmbeddingShardingPlanner, Topology
  from torchrec.distributed.sharding_plan import get_default_sharders
  from torchrec.distributed.types import ModuleSharder, ShardedModule, ShardingEnv, ShardingPlan
  from torchrec.distributed.utils import add_prefix_to_state_dict, append_prefix, copy_to_device, filter_state_dict, sharded_model_copy
  from torchrec.optim.fused import FusedOptimizerModule
  from torchrec.optim.keyed import CombinedOptimizer, KeyedOptimizer
label_desc: Use image node_id 2 for calling the DefaultDataParallelWrapper obj's underlying member method code with example usage: obj._ddp_wrap(dmp, env, device, ddp_ignore_param_names) without return types