code: def _copy_config(
      original: GroupedEmbeddingConfig,
      data_type: DataType,
      sparse_type: SparseType,
      device: torch.device,
  ) -> GroupedEmbeddingConfig:
      # Adjust config to quantized version.
      # This obviously doesn't work for column-wise sharding.
      config = copy.deepcopy(original)
      config.data_type = data_type
      for table in config.embedding_tables:
          row_alignment = 16 if device.type == "cuda" else 1
          table.local_cols = rounded_row_size_in_bytes(
              table.local_cols, sparse_type, row_alignment
          )
          if table.local_metadata is not None:
              table.local_metadata.shard_sizes = [
                  table.local_rows,
                  table.local_cols,
              ]
  
          global_metadata = table.global_metadata
          if global_metadata is not None:
              for shard_meta in global_metadata.shards_metadata:
                  if shard_meta != table.local_metadata:
                      shard_meta.shard_sizes = [
                          shard_meta.shard_sizes[0],
                          rounded_row_size_in_bytes(
                              shard_meta.shard_sizes[1],
                              sparse_type,
                              row_alignment,
                          ),
                      ]
              global_metadata.size = torch.Size(
                  [
                      global_metadata.size[0],
                      sum(
                          shard_meta.shard_sizes[1]
                          for shard_meta in global_metadata.shards_metadata
                      ),
                  ]
              )
      return config
  
imports: import copy
  import logging
  from typing import Any, Dict, Iterator, List, Optional, Tuple
  import torch
  import torch.distributed
  from fbgemm_gpu.split_embedding_configs import SparseType
  from fbgemm_gpu.split_table_batched_embeddings_ops_inference import EmbeddingLocation, IntNBitTableBatchedEmbeddingBagsCodegen, PoolingMode, rounded_row_size_in_bytes
  from torchrec.distributed.batched_embedding_kernel import BaseBatchedEmbedding, BaseBatchedEmbeddingBag, BatchedDenseEmbedding, BatchedDenseEmbeddingBag
  from torchrec.distributed.embedding_kernel import BaseEmbedding
  from torchrec.distributed.embedding_types import compute_kernel_to_embedding_location, GroupedEmbeddingConfig
  from torchrec.distributed.fused_params import is_fused_param_quant_state_dict_split_scale_bias, is_fused_param_register_tbe, tbe_fused_params, TBEToRegisterMixIn
  from torchrec.distributed.utils import append_prefix
  from torchrec.modules.embedding_configs import DATA_TYPE_NUM_BITS, data_type_to_sparse_type, DataType, dtype_to_data_type
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
label_desc: Use image node_id 1 for calling a global function with example usage: _copy_config(original, data_type, sparse_type, device) and returns: config