code: def _quantize(
      module: nn.Module,
      inplace: bool,
      output_type: torch.dtype = torch.float,
      quant_state_dict_split_scale_bias: bool = False,
      per_table_weight_dtypes: Optional[Dict[str, torch.dtype]] = None,
  ) -> nn.Module:
      if quant_state_dict_split_scale_bias:
          quant_prep_enable_quant_state_dict_split_scale_bias_for_types(
              module, [EmbeddingBagCollection]
          )
      qconfig = quant.QConfig(
          activation=quant.PlaceholderObserver.with_args(
              dtype=output_type
          ),
          weight=quant.PlaceholderObserver.with_args(dtype=torch.qint8),
      )
      if per_table_weight_dtypes:
          qconfig = QuantConfig(
              activation=quant.PlaceholderObserver.with_args(
                  dtype=output_type
              ),
              weight=quant.PlaceholderObserver.with_args(
                  dtype=torch.quint8
              ),
              per_table_weight_dtype=per_table_weight_dtypes,
          )
  
      return quant.quantize_dynamic(
          module,
          qconfig_spec={
              EmbeddingBagCollection: qconfig,
          },
          mapping={
              EmbeddingBagCollection: QuantEmbeddingBagCollection,
          },
          inplace=inplace,
      )
  
imports: import unittest
  from typing import Any, cast, Dict, List, Optional, Tuple
  import hypothesis.strategies
  import torch
  from hypothesis import given, settings, Verbosity
  from torch import nn, quantization
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel, ModuleSharder
  from torchrec.distributed.model_parallel import DistributedModelParallel
  from torchrec.distributed.planner import EmbeddingShardingPlanner, Topology
  from torchrec.distributed.planner.enumerators import EmbeddingEnumerator
  from torchrec.distributed.planner.shard_estimators import EmbeddingPerfEstimator, EmbeddingStorageEstimator
  from torchrec.distributed.quant_embeddingbag import QuantEmbeddingBagCollectionSharder
  from torchrec.distributed.shard import _shard_modules
  from torchrec.distributed.test_utils.test_model import _get_default_rtol_and_atol, ModelInput, TestSparseNN
  from torchrec.distributed.types import ShardedModule, ShardingEnv, ShardingType
  from torchrec.distributed.utils import copy_to_device
  from torchrec.modules.embedding_configs import EmbeddingBagConfig, QuantConfig
  from torchrec.modules.embedding_modules import EmbeddingBagCollection
  from torchrec.quant.embedding_modules import EmbeddingBagCollection, quant_prep_enable_quant_state_dict_split_scale_bias_for_types
  from torchrec.types import CopyMixIn
label_desc: Use image node_id 1 for calling a global function with example usage: _quantize(module, inplace, output_type, quant_state_dict_split_scale_bias, per_table_weight_dtypes) and returns: quant