code: def _generate_batch(self) -> Batch:
      values = []
      lengths = []
      for key_idx, _ in enumerate(self.keys):
          hash_size = self.hash_sizes[key_idx]
          min_num_ids_in_batch = self.min_ids_per_features[key_idx]
          max_num_ids_in_batch = self.ids_per_features[key_idx]
          for _ in range(self.batch_size):
              num_ids_in_batch = int(
                  torch.randint(
                      low=min_num_ids_in_batch,
                      high=max_num_ids_in_batch + 1,
                      size=(),
                      generator=self.generator,
                  ).item()
              )
              values.append(
                  torch.randint(
                      high=hash_size,
                      size=(num_ids_in_batch,),
                      generator=self.generator,
                  )
              )
              lengths.extend([num_ids_in_batch])
  
      sparse_features = KeyedJaggedTensor.from_lengths_sync(
          keys=self.keys,
          values=torch.cat(values),
          lengths=torch.tensor(lengths, dtype=torch.int32),
      )
  
      dense_features = torch.randn(
          self.batch_size,
          self.num_dense,
          generator=self.generator,
      )
      labels = torch.randint(
          low=0,
          high=2,
          size=(self.batch_size,),
          generator=self.generator,
      )
  
      batch = Batch(
          dense_features=dense_features,
          sparse_features=sparse_features,
          labels=labels,
      )
      return batch
  
file_path: torchrec/torchrec/datasets/random.py
imports: import itertools
  import sys
  from typing import cast, Iterator, List, Optional
  import torch
  from torch.utils.data.dataset import IterableDataset
  from torchrec.datasets.utils import Batch
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
label_desc: Use image node_id 4 for calling the _RandomRecBatch obj's underlying member method code with example usage: obj._generate_batch() and returns: batch