code: def parse_progress_logs_for_nonlinearity_stats(exp_dir):
      """Parse progress logs for mean and std stats for non-linearities.
      e.g. for a line that is parsed from progress.*.log:
      exp/nnet3/lstm_self_repair_ld5_sp/log/progress.9.log:component name=Lstm3_i
      type=SigmoidComponent, dim=1280, self-repair-scale=1e-05, count=1.96e+05,
      value-avg=[percentiles(0,1,2,5 10,20,50,80,90
      95,98,99,100)=(0.05,0.09,0.11,0.15 0.19,0.27,0.50,0.72,0.83
      0.88,0.92,0.94,0.99), mean=0.502, stddev=0.23],
      deriv-avg=[percentiles(0,1,2,5 10,20,50,80,90
      95,98,99,100)=(0.009,0.04,0.05,0.06 0.08,0.10,0.14,0.17,0.18
      0.19,0.20,0.20,0.21), mean=0.134, stddev=0.0397]
      """
  
      progress_log_files = "%s/log/progress.*.log" % (exp_dir)
      stats_per_component_per_iter = {}
  
      progress_log_lines = common_lib.get_command_stdout(
          'grep -e "value-avg.*deriv-avg.*oderiv" {0}'.format(
              progress_log_files
          ),
          require_zero_status=False,
      )
  
      if progress_log_lines:
          # cases with oderiv-rms
          parse_regex = re.compile(
              g_normal_nonlin_regex_pattern_with_oderiv
          )
      else:
          # cases with only value-avg and deriv-avg
          progress_log_lines = common_lib.get_command_stdout(
              'grep -e "value-avg.*deriv-avg" {0}'.format(
                  progress_log_files
              ),
              require_zero_status=False,
          )
          parse_regex = re.compile(g_normal_nonlin_regex_pattern)
  
      for line in progress_log_lines.split("\n"):
          mat_obj = parse_regex.search(line)
          if mat_obj is None:
              continue
          # groups = ('9', 'Lstm3_i', 'Sigmoid', '0.05...0.99', '0.502', '0.23',
          # '0.009...0.21', '0.134', '0.0397')
          groups = mat_obj.groups()
          component_type = groups[2]
          if component_type == "LstmNonlinearity":
              parse_regex_lstmp = re.compile(
                  g_lstmp_nonlin_regex_pattern
              )
              mat_obj = parse_regex_lstmp.search(line)
              groups = mat_obj.groups()
              assert len(groups) == 33
              for i in list(range(0, 5)):
                  fill_nonlin_stats_table_with_regex_result(
                      groups, i, stats_per_component_per_iter
                  )
          else:
              fill_nonlin_stats_table_with_regex_result(
                  groups, 0, stats_per_component_per_iter
              )
      return stats_per_component_per_iter
  
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 2 for calling a global function with example usage: parse_progress_logs_for_nonlinearity_stats(exp_dir) and returns: stats_per_component_per_iter