class_docstr: Benchmark class for Flax examples.
  
  This class overrides the behaviour of `self.assert*` methods to be
  deferred instead of failing immediately. This allows for using absltest
  assert methods for checking benchmark target metrics. This is also
  necessary for correctly reporting benchmark results and determining its
  success.
class_docstr_tok: ["Benchmark","class","for","Flax","examples",".","This","class","overrides","the","behaviour","of","`","self.assert","*","`","methods","to","be","deferred","instead","of","failing","immediately",".","This","allows","for","using","absltest","assert","methods","for","checking","benchmark","target","metrics",".","This","is","also","necessary","for","correctly","reporting","benchmark","results","and","determining","its","success","."]
docstr: Returns an unique temporary directory for storing model data.
  
  Returns path by appending Classname.testname to `benchmark_output_dir` flag
  if defined else uses a temporary directory. This helps to export summary
  files to tensorboard as multiple separate runs for each test method.
docstr_tok: ["Returns","an","unique","temporary","directory","for","storing","model","data",".","Returns","path","by","appending","Classname.testname","to","`","benchmark_output_dir","`","flag","if","defined","else","uses","a","temporary","directory",".","This","helps","to","export","summary","files","to","tensorboard","as","multiple","separate","runs","for","each","test","method","."]
code: def get_tmp_model_dir(self):
      """Returns an unique temporary directory for storing model data.
  
      Returns path by appending Classname.testname to `benchmark_output_dir` flag
      if defined else uses a temporary directory. This helps to export summary
      files to tensorboard as multiple separate runs for each test method.
      """
      if FLAGS.benchmark_output_dir:
          model_dir = FLAGS.benchmark_output_dir
      else:
          model_dir = tempfile.mkdtemp()
      model_dir_path = os.path.join(
          model_dir, self._reported_name or self._get_test_name()
      )
      # Create directories if they don't exist.
      if not io.exists(model_dir_path):
          io.makedirs(model_dir_path)
      return model_dir_path
  
imports: import functools
  import inspect
  import itertools
  import json
  import os
  import tempfile
  from typing import Dict
  from absl import flags, logging
  from absl.testing import absltest
  from tensorboard.backend.event_processing import directory_watcher, event_file_loader, io_wrapper
  from tensorboard.summary import v1
  from tensorboard.util import tensor_util
  from flax import io
label_desc: Use image node_id 5 for calling the Benchmark obj's underlying member method code with example usage: obj.get_tmp_model_dir() and returns: model_dir_path