code: def test_weighted(self) -> None:
      eb1_config = EmbeddingBagConfig(
          name="t1",
          embedding_dim=3,
          num_embeddings=10,
          feature_names=["f1", "f3"],
      )
      eb2_config = EmbeddingBagConfig(
          name="t2",
          embedding_dim=4,
          num_embeddings=10,
          feature_names=["f2"],
      )
      ebc = EmbeddingBagCollection(
          tables=[eb1_config, eb2_config], is_weighted=True
      )
  
      features = KeyedJaggedTensor.from_offsets_sync(
          keys=["f1", "f3", "f2"],
          values=torch.tensor([1, 2, 4, 5, 4, 3, 2, 9, 1, 3, 4, 7]),
          offsets=torch.tensor([0, 2, 4, 6, 8, 10, 12]),
          weights=torch.tensor(
              [
                  0.1,
                  0.2,
                  0.4,
                  0.5,
                  0.4,
                  0.3,
                  0.2,
                  0.9,
                  0.1,
                  0.3,
                  0.4,
                  0.7,
              ]
          ),
      )
  
      pooled_embeddings = ebc(features)
      self.assertEqual(pooled_embeddings.values().size(), (2, 10))
      self.assertEqual(pooled_embeddings.keys(), ["f1", "f3", "f2"])
      self.assertEqual(
          pooled_embeddings.offset_per_key(), [0, 3, 6, 10]
      )
  
imports: import unittest
  from functools import partial
  import torch
  import torch.fx
  from torchrec.fx import symbolic_trace
  from torchrec.modules.embedding_configs import EmbeddingBagConfig, EmbeddingConfig
  from torchrec.modules.embedding_modules import EmbeddingBagCollection, EmbeddingCollection
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
label_desc: Use image node_id 4 for calling the EmbeddingBagCollectionTest obj's underlying member method code with example usage: obj.test_weighted() without return types