code: def generate_acc_logprob_report(
      exp_dir, key="accuracy", output="output"
  ):
      try:
          times = get_train_times(exp_dir)
      except:
          tb = traceback.format_exc()
          logger.warning(
              "Error getting info from logs, exception was: " + tb
          )
          times = {}
  
      report = []
      report.append(
          "%Iter\tduration\ttrain_objective\tvalid_objective\tdifference"
      )
      try:
          if key == "rnnlm_objective":
              data = list(parse_rnnlm_prob_logs(exp_dir, "objf"))
          else:
              data = list(parse_prob_logs(exp_dir, key, output))
      except:
          tb = traceback.format_exc()
          logger.warning(
              "Error getting info from logs, exception was: " + tb
          )
          data = []
      for x in data:
          try:
              report.append(
                  "%d\t%s\t%g\t%g\t%g"
                  % (x[0], str(times[x[0]]), x[1], x[2], x[2] - x[1])
              )
          except (KeyError, IndexError):
              continue
  
      total_time = 0
      for iter in times.keys():
          total_time += times[iter]
      report.append(
          "Total training time is {0}\n".format(
              str(datetime.timedelta(seconds=total_time))
          )
      )
      return ["\n".join(report), times, data]
  
imports: from __future__ import division
  from __future__ import print_function
  import traceback
  import datetime
  import logging
  import re
  import libs.common
label_desc: Use image node_id 9 for calling a global function with example usage: generate_acc_logprob_report(exp_dir, key, output) and returns: list