code: def _test_ec(
      self,
      tables: List[EmbeddingConfig],
      features: KeyedJaggedTensor,
      quant_type: torch.dtype = torch.qint8,
      output_type: torch.dtype = torch.float,
      quant_state_dict_split_scale_bias: bool = False,
  ) -> None:
      ec = EmbeddingCollection(tables=tables)
      if quant_state_dict_split_scale_bias:
          quant_prep_enable_quant_state_dict_split_scale_bias(ec)
  
      embeddings = ec(features)
  
      # test forward
      ec.qconfig = torch.quantization.QConfig(
          activation=torch.quantization.PlaceholderObserver.with_args(
              dtype=output_type
          ),
          weight=torch.quantization.PlaceholderObserver.with_args(
              dtype=quant_type
          ),
      )
  
      qec = QuantEmbeddingCollection.from_float(ec)
      quantized_embeddings = qec(features)
      self.assertEqual(
          list(quantized_embeddings.values())[0].values().dtype,
          output_type,
      )
  
      self.assertEqual(embeddings.keys(), quantized_embeddings.keys())
      for key in embeddings.keys():
          self.assertEqual(
              embeddings[key].values().size(),
              quantized_embeddings[key].values().size(),
          )
          self.assertTrue(
              torch.allclose(
                  embeddings[key].values().cpu().float(),
                  quantized_embeddings[key].values().cpu().float(),
                  atol=1,
              )
          )
  
      # test state dict
      state_dict = ec.state_dict()
      quantized_state_dict = ec.state_dict()
      self.assertEqual(state_dict.keys(), quantized_state_dict.keys())
  
imports: import unittest
  from typing import Dict, List, Optional, Type
  import hypothesis.strategies
  import torch
  from hypothesis import given, settings, Verbosity
  from torchrec import inference
  from torchrec.modules.embedding_configs import DataType, EmbeddingBagConfig, EmbeddingConfig, QuantConfig
  from torchrec.modules.embedding_modules import EmbeddingBagCollection, EmbeddingCollection
  from torchrec.quant.embedding_modules import EmbeddingBagCollection, EmbeddingCollection, quant_prep_enable_quant_state_dict_split_scale_bias
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor, KeyedTensor
label_desc: Use image node_id 1 for calling the EmbeddingCollectionTest obj's underlying member method code with example usage: obj._test_ec(tables, features, quant_type, output_type, quant_state_dict_split_scale_bias) without return types