code: def test_weighted(self, device: torch.device) -> None:
      eb1_config = EmbeddingBagConfig(
          name="t1",
          embedding_dim=4,
          num_embeddings=2,
          feature_names=["f1"],
      )
      eb2_config = EmbeddingBagConfig(
          name="t2",
          embedding_dim=4,
          num_embeddings=2,
          feature_names=["f2"],
      )
  
      ebc = FusedEmbeddingBagCollection(
          tables=[eb1_config, eb2_config],
          optimizer_type=torch.optim.SGD,
          optimizer_kwargs={"lr": 0.02},
          is_weighted=True,
          device=device,
      )
  
      ebc.load_state_dict(
          OrderedDict(
              [
                  (
                      "embedding_bags.t1.weight",
                      torch.Tensor([[1, 1, 1, 1], [2, 2, 2, 2]]),
                  ),
                  (
                      "embedding_bags.t2.weight",
                      torch.Tensor([[4, 4, 4, 4], [8, 8, 8, 8]]),
                  ),
              ]
          )
      )
  
      #     0       1        2  <-- batch
      # f1   [0,1] []    [0]
      # f2   [0]    [1]    [0,1]
      # feature
  
      #     0       1        2  <-- batch
      # f1  [1.0,2.0] [] [3.0]
      # f2   [5.0]    [7.0]    [11.0, 13.0]
      # weight
      features = KeyedJaggedTensor.from_lengths_sync(
          keys=["f1", "f2"],
          values=torch.tensor([0, 1, 0, 0, 1, 0, 1]),
          weights=torch.tensor([1.0, 2.0, 3.0, 5.0, 7.0, 11.0, 13.0]),
          lengths=torch.tensor([2, 0, 1, 1, 1, 2]),
      ).to(device)
  
      pooled_embeddings = ebc(features)
  
      torch.testing.assert_close(
          pooled_embeddings["f1"],
          torch.tensor(
              [[5.0] * 4, [0.0] * 4, [3.0] * 4],
              dtype=torch.float32,
              device=device,
          ),
      )
  
      torch.testing.assert_close(
          pooled_embeddings["f2"],
          torch.tensor(
              [[20.0] * 4, [56.0] * 4, [4 * 11 + 8 * 13] * 4],
              dtype=torch.float32,
              device=device,
          ),
      )
  
imports: import unittest
  from collections import OrderedDict
  from typing import Any, Dict, List, Optional, Tuple, Type
  import hypothesis.strategies
  import torch
  import torch.fx
  import torchrec
  from fbgemm_gpu.split_table_batched_embeddings_ops_training import EmbeddingLocation
  from hypothesis import given, settings
  from torchrec.modules.embedding_configs import EmbeddingBagConfig, EmbeddingConfig
  from torchrec.modules.embedding_modules import EmbeddingBagCollection, EmbeddingCollection
  from torchrec.modules.fused_embedding_modules import fuse_embedding_optimizer, FusedEmbeddingBagCollection, FusedEmbeddingCollection
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
label_desc: Use image node_id 8 for calling the FusedEmbeddingBagCollectionTest obj's underlying member method code with example usage: obj.test_weighted(device) without return types