class_docstr: Allows copying of DistributedModelParallel module to a target device.
  
  Example::
  
      # Copying model to CPU.
  
      m = DistributedModelParallel(m)
      with sharded_model_copy("cpu"):
          m_cpu = copy.deepcopy(m)
class_docstr_tok: ["Allows","copying","of","DistributedModelParallel","module","to","a","target","device",".","Example",":",":","#","Copying","model","to","CPU",".","m","=","DistributedModelParallel","(","m",")","with","sharded_model_copy","(","``","cpu","''",")",":","m_cpu","=","copy.deepcopy","(","m",")"]
code: def __init__(
      self, device: Optional[Union[str, int, torch.device]]
  ) -> None:
      self.device = device
  
imports: import copy
  import logging
  from collections import OrderedDict
  from itertools import accumulate
  from typing import Any, Dict, List, Optional, Set, Type, TypeVar, Union
  import torch
  from fbgemm_gpu.split_embedding_configs import EmbOptimType
  from torch import nn
  from torchrec import optim
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel
  from torchrec.distributed.types import DataType, ParameterSharding, ShardedModule, ShardingType
  from torchrec.modules.embedding_configs import data_type_to_sparse_type
  from torchrec.types import CopyMixIn
label_desc: Use image node_id 1 to create a new sharded_model_copy object  with example: obj = sharded_model_copy(device)