code: def generate_random_tfrecords(
      num_rows: int,
      *,
      num_int: int = 0,
      num_float: int = 0,
      num_bytes: int = 0,
      bytes_size: int = 0,
  ) -> str:
      def generate_features(batch):
          batch_size = len(batch["id"])
          features = {
              "int_features": [],
              "float_features": [],
              "bytes_features": [],
          }
          lower_bound = -(2**32)
          upper_bound = 2**32
          for _ in range(batch_size):
              if num_int > 0:
                  int_features = [
                      random.randint(lower_bound, upper_bound)
                      for _ in range(num_int)
                  ]
                  features["int_features"].append(int_features)
              if num_float > 0:
                  float_features = [
                      random.uniform(lower_bound, upper_bound)
                      for _ in range(num_float)
                  ]
                  features["float_features"].append(float_features)
              if num_bytes > 0:
                  bytes_features = [
                      np.random.bytes(bytes_size)
                      for _ in range(num_bytes)
                  ]
                  features["bytes_features"].append(bytes_features)
          features = {k: v for (k, v) in features.items() if len(v) > 0}
          return pa.table(features)
  
      ds = ray.data.range(num_rows).map_batches(generate_features)
      assert ds.count() == num_rows, ds.count()
  
      tfrecords_dir = tempfile.mkdtemp()
      ds.write_tfrecords(tfrecords_dir)
      return tfrecords_dir
  
file_path: ray/release/nightly_tests/dataset/read_tfrecords_benchmark.py
imports: import random
  import shutil
  import tempfile
  from typing import List, Tuple
  import ray
  from ray.data.dataset import Dataset
  from benchmark import Benchmark
  from read_images_benchmark import generate_images
  import pyarrow
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: generate_random_tfrecords(num_rows) and returns: tfrecords_dir, pa