code: def quantize_embeddings(
      module: nn.Module,
      dtype: torch.dtype,
      inplace: bool,
      additional_qconfig_spec_keys: Optional[
          List[Type[nn.Module]]
      ] = None,
      additional_mapping: Optional[
          Dict[Type[nn.Module], Type[nn.Module]]
      ] = None,
      output_dtype: torch.dtype = torch.float,
      per_table_weight_dtype: Optional[Dict[str, torch.dtype]] = None,
  ) -> nn.Module:
      qconfig = QuantConfig(
          activation=quant.PlaceholderObserver.with_args(
              dtype=output_dtype
          ),
          weight=quant.PlaceholderObserver.with_args(dtype=dtype),
          per_table_weight_dtype=per_table_weight_dtype,
      )
      qconfig_spec: Dict[Type[nn.Module], QuantConfig] = {
          trec.EmbeddingBagCollection: qconfig,
      }
      mapping: Dict[Type[nn.Module], Type[nn.Module]] = {
          trec.EmbeddingBagCollection: trec_quant.EmbeddingBagCollection,
      }
      if additional_qconfig_spec_keys is not None:
          for t in additional_qconfig_spec_keys:
              qconfig_spec[t] = qconfig
      if additional_mapping is not None:
          mapping.update(additional_mapping)
      return quant.quantize_dynamic(
          module,
          qconfig_spec=qconfig_spec,
          mapping=mapping,
          inplace=inplace,
      )
  
imports: import abc
  import json
  from dataclasses import asdict, dataclass
  from typing import Any, Dict, List, Optional, Tuple, Type
  import torch
  import torch.nn
  import torch.quantization
  import torchrec
  import torchrec.quant
  from torchrec.modules.embedding_configs import QuantConfig
  from torchrec.modules.embedding_modules import EmbeddingBagCollectionInterface, EmbeddingCollectionInterface
label_desc: Use image node_id 3 for calling a global function with example usage: quantize_embeddings(module, dtype, inplace, additional_qconfig_spec_keys, additional_mapping, output_dtype, per_table_weight_dtype) and returns: quant