class_docstr: Benchmark return tests for Soft Actor Critic (SAC) Haarnoja18.
docstr: Benchmarks MuJoCo HalfCheetah to 3M steps.
code: def benchmark_halfcheetah_v2(self):
      """Benchmarks MuJoCo HalfCheetah to 3M steps."""
      self.setUp()
      output_dir = self._get_test_output_dir("halfcheetah_v2")
      start_time_sec = time.time()
      # TODO(b/172017027): Use halfcheetah gin config.
      strategy = tf.distribute.get_strategy()
      sac_train_eval.train_eval(
          output_dir,
          strategy,
          initial_collect_steps=10000,
          env_name="HalfCheetah-v2",
          eval_interval=50000,
          num_iterations=3000000,
      )
      wall_time_sec = time.time() - start_time_sec
      event_file = utils.find_event_log(
          os.path.join(output_dir, "eval")
      )
      values, _ = utils.extract_event_log_values(
          event_file, "Metrics/AverageReturn"
      )
  
      # Min/Max ranges are very large to only hard fail if very broken. The system
      # monitoring the results owns looking for anomalies.
      metric_1m = self.build_metric(
          "average_return_at_env_step1000000",
          values[1000000],
          min_value=800,
          max_value=16000,
      )
  
      metric_3m = self.build_metric(
          "average_return_at_env_step3000000",
          values[3000000],
          min_value=12000,
          max_value=16500,
      )
  
      self.report_benchmark(
          wall_time=wall_time_sec,
          metrics=[metric_1m, metric_3m],
          extras={},
      )
  
file_path: agents/tf_agents/benchmark/sac_benchmark.py
imports: import os
  import time
  import tensorflow
  from tf_agents.benchmark import utils
  from tf_agents.benchmark.perfzero_benchmark import PerfZeroBenchmark
  from tf_agents.examples.sac.haarnoja18 import sac_train_eval
label_desc: Use image node_id 2 for calling the SacHaarnoja18Return obj's underlying member method code with example usage: obj.benchmark_halfcheetah_v2() without return types