class_docstr: Runs ImageNet using fake data for quickly measuring performance.
class_docstr_tok: ["Runs","ImageNet","using","fake","data","for","quickly","measuring","performance","."]
code: def test_fake_data(self):
      workdir = self.get_tmp_model_dir()
      config = config_lib.get_config()
      # Go two directories up to the root of the flax directory.
      flax_root_dir = pathlib.Path(__file__).absolute().parents[2]
      data_dir = str(flax_root_dir) + "/.tfds/metadata"
  
      # Warm-up first so that we are not measuring just compilation.
      with tfds.testing.mock_data(num_examples=1024, data_dir=data_dir):
          train.train_and_evaluate(config, workdir)
  
      start_time = time.time()
      with tfds.testing.mock_data(num_examples=1024, data_dir=data_dir):
          train.train_and_evaluate(config, workdir)
      benchmark_time = time.time() - start_time
  
      self.report_wall_time(benchmark_time)
      self.report_extras(
          {
              "description": "ImageNet ResNet50 with fake data",
              "model_name": "resnet50",
              "parameters": f"hp=true,bs={config.batch_size}",
          }
      )
  
file_path: flax/examples/imagenet/imagenet_fake_data_benchmark.py
imports: import pathlib
  import time
  from absl.testing import absltest
  from flax.testing import Benchmark
  import jax
  import tensorflow_datasets
  from configs import fake_data_benchmark
  import train
label_desc: Use image node_id 1 for calling the ImagenetBenchmarkFakeData obj's underlying member method code with example usage: obj.test_fake_data() without return types