code: def _parse_dropout_string(dropout_str):
      """Parses the dropout schedule from the string corresponding to a
      single component in --trainer.dropout-schedule.
      This is a module-internal function called by parse_dropout_function().
  
      Arguments:
          dropout_str: Specifies dropout schedule for a particular component
              name pattern.
              See help for the option --trainer.dropout-schedule.
  
      Returns a list of (data_fraction_processed, dropout_proportion) tuples
      sorted in descending order of num_archives_processed.
      A data fraction of 1 corresponds to all data.
      """
      dropout_values = []
      parts = dropout_str.strip().split(",")
  
      try:
          if len(parts) < 2:
              raise Exception(
                  "dropout proportion string must specify "
                  "at least the start and end dropouts"
              )
  
          # Starting dropout proportion
          dropout_values.append((0, float(parts[0])))
          for i in range(1, len(parts) - 1):
              value_x_pair = parts[i].split("@")
              if len(value_x_pair) == 1:
                  # Dropout proportion at half of training
                  dropout_proportion = float(value_x_pair[0])
                  data_fraction = 0.5
              else:
                  assert len(value_x_pair) == 2
  
                  dropout_proportion = float(value_x_pair[0])
                  data_fraction = float(value_x_pair[1])
  
              if (
                  data_fraction < dropout_values[-1][0]
                  or data_fraction > 1.0
              ):
                  logger.error(
                      "Failed while parsing value %s in dropout-schedule. "
                      "dropout-schedule must be in incresing "
                      "order of data fractions.",
                      value_x_pair,
                  )
                  raise ValueError
  
              dropout_values.append(
                  (data_fraction, float(dropout_proportion))
              )
  
          dropout_values.append((1.0, float(parts[-1])))
      except Exception:
          logger.error(
              "Unable to parse dropout proportion string %s. "
              "See help for option "
              "--trainer.dropout-schedule.",
              dropout_str,
          )
          raise
  
      # reverse sort so that its easy to retrieve the dropout proportion
      # for a particular data fraction
      dropout_values.reverse()
      for data_fraction, proportion in dropout_values:
          assert data_fraction <= 1.0 and data_fraction >= 0.0
          assert proportion <= 1.0 and proportion >= 0.0
  
      return dropout_values
  
file_path: espnet/egs2/swbd/asr1/steps/libs/nnet3/train/dropout_schedule.py
imports: import logging
label_desc: Use image node_id 2 for calling a global function with example usage: _parse_dropout_string(dropout_str) and returns: dropout_values