timitphonemerec_test.py
def parse_args():
  """ Parse command-line arguments and results-dir arguments.

  Returns:
    A tuple, `(args, params_str, layer_kwargs)`.
  """
  description = main.__doc__
  formatter_class = argparse.ArgumentDefaultsHelpFormatter
  parser = argparse.ArgumentParser(description=description, formatter_class=formatter_class)

  parser.add_argument('--data_dir', type=str, default=timitphonemerec.DEFAULT_DATA_DIR,
                      help='''The directory we will load the data from.''')
  parser.add_argument('--results_dir', type=str, default=timitphonemerec.DEFAULT_DATA_DIR,
                      help='''The results directory. Required.''')

  args = parser.parse_args()
  args.data_dir = os.path.expanduser(args.data_dir)
  args.results_dir = os.path.normpath(os.path.expanduser(args.results_dir))

  _, params_str = os.path.split(args.results_dir)
  params = params_str.split('_')
  if len(PARAM_STR_TYPES) != len(params):
    raise ValueError('results_dir is improperly named.')

  params = [type_func(p) for type_func, p in zip(PARAM_STR_TYPES, params)]

  (
    args.layer_type, args.activation_type, args.num_hidden_units, args.learning_rate,
    args.optional_bias_shift, args.num_pre_act_mixture_delays, args.trial
  ) = params

  args.pre_act_mixture_delays = 2 ** np.arange(args.num_pre_act_mixture_delays, dtype=np.int)

  layer_kwargs = {
    'optional_bias_shift': args.optional_bias_shift,
    'pre_act_mixture_delays': args.pre_act_mixture_delays,
  }

  return args, params_str, layer_kwargs
 Parse command-line arguments and results-dir arguments.

  Returns:
    A tuple, `(args, params_str, layer_kwargs)`.
  
Parse command-line arguments and results-dir arguments.
Parse command - line arguments and results - dir arguments .
def parse_args():
  description = main.__doc__
  formatter_class = argparse.ArgumentDefaultsHelpFormatter
  parser = argparse.ArgumentParser(description=description, formatter_class=formatter_class)
  parser.add_argument('--data_dir', type=str, default=timitphonemerec.DEFAULT_DATA_DIR,
                      help='''The directory we will load the data from.''')
  parser.add_argument('--results_dir', type=str, default=timitphonemerec.DEFAULT_DATA_DIR,
                      help='''The results directory. Required.''')
  args = parser.parse_args()
  args.data_dir = os.path.expanduser(args.data_dir)
  args.results_dir = os.path.normpath(os.path.expanduser(args.results_dir))
  _, params_str = os.path.split(args.results_dir)
  params = params_str.split('_')
  if len(PARAM_STR_TYPES) != len(params):
    raise ValueError('results_dir is improperly named.')
  params = [type_func(p) for type_func, p in zip(PARAM_STR_TYPES, params)]
  (
    args.layer_type, args.activation_type, args.num_hidden_units, args.learning_rate,
    args.optional_bias_shift, args.num_pre_act_mixture_delays, args.trial
  ) = params
  args.pre_act_mixture_delays = 2 ** np.arange(args.num_pre_act_mixture_delays, dtype=np.int)
  layer_kwargs = {
    'optional_bias_shift': args.optional_bias_shift,
    'pre_act_mixture_delays': args.pre_act_mixture_delays,
  }
  return args, params_str, layer_kwargs
def parse_args ( ) : description = main . __doc__ formatter_class = argparse . ArgumentDefaultsHelpFormatter parser = argparse . ArgumentParser ( description = description , formatter_class = formatter_class ) parser . add_argument ( '--data_dir' , type = str , default = timitphonemerec . DEFAULT_DATA_DIR , help = '''The directory we will load the data from.''' ) parser . add_argument ( '--results_dir' , type = str , default = timitphonemerec . DEFAULT_DATA_DIR , help = '''The results directory. Required.''' ) args = parser . parse_args ( ) args . data_dir = os . path . expanduser ( args . data_dir ) args . results_dir = os . path . normpath ( os . path . expanduser ( args . results_dir ) ) _ , params_str = os . path . split ( args . results_dir ) params = params_str . split ( '_' ) if len ( PARAM_STR_TYPES ) != len ( params ) : raise ValueError ( 'results_dir is improperly named.' ) params = [ type_func ( p ) for type_func , p in zip ( PARAM_STR_TYPES , params ) ] ( args . layer_type , args . activation_type , args . num_hidden_units , args . learning_rate , args . optional_bias_shift , args . num_pre_act_mixture_delays , args . trial ) = params args . pre_act_mixture_delays = 2 ** np . arange ( args . num_pre_act_mixture_delays , dtype = np . int ) layer_kwargs = { 'optional_bias_shift' : args . optional_bias_shift , 'pre_act_mixture_delays' : args . pre_act_mixture_delays , } return args , params_str , layer_kwargs
Parse command-line arguments and results-dir arguments.
Parse command - line arguments and results - dir arguments .
""" Parse command-line arguments and results-dir arguments.

  Returns:
    A tuple, `(args, params_str, layer_kwargs)`.
  """
A tuple, `(args, params_str, layer_kwargs)`.
A tuple ` ( args params_str layer_kwargs ) ` .