copyproblem_train.py
def parse_args():
  """ Parse command-line 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=copyproblem.DEFAULT_DATA_DIR,
                      help='''The directory we will load data from and save results to.''')
  parser.add_argument('--debug', type=int, default=0,
                      help='''If 1, print some useful information.''')
  parser.add_argument('--copy_delay', type=int, default=100,
                      help='''The copy delay between presentation time and copy time. Must be divisible by 10.''')
  parser.add_argument('--layer_type', type=str, default='MISTLayer',
                      help='''The RNN layer to use. See `layers`.''')
  parser.add_argument('--activation_type', type=str, default='tanh',
                      help='''An element-wise activation. See `tensorflow.nn`.''')
  parser.add_argument('--num_hidden_units', type=int, default=141,
                      help='''The number of hidden units to use in the recurrent model.''')
  parser.add_argument('--optimizer', type=str, default='ClippingMomentumOptimizer',
                      help='''The Optimizer to use. See `optimizers`.''')
  parser.add_argument('--learning_rate', type=float, default=1.0,
                      help='''The learning rate.''')
  parser.add_argument('--optional_bias_shift', type=float, default=1.0,
                      help='''Used with LSTMLayer and GRULayer. In the case of LSTM, this is
                              more commonly known as forget-gate bias.''')
  parser.add_argument('--num_pre_act_mixture_delays', type=int, default=8,
                      help='''Used only with the MISTLayer.''')
  parser.add_argument('--trial', type=int, default=0,
                      help='''Useful if we'd like to run multiple trials with identical parameters.''')

  args = parser.parse_args()
  args.data_dir = os.path.expanduser(args.data_dir)
  args.pre_act_mixture_delays = 2 ** np.arange(args.num_pre_act_mixture_delays, dtype=np.int)

  params_str = '_'.join([
    '%d' % args.copy_delay,
    '%s' % args.layer_type,
    '%s' % args.activation_type,
    '%04d' % args.num_hidden_units,
    '%.6f' % args.learning_rate,
    '%.1f' % args.optional_bias_shift,
    '%d' % args.num_pre_act_mixture_delays,
    '%02d' % args.trial
  ])

  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.

  Returns:
    A tuple, `(args, params_str, layer_kwargs)`.
  
Parse command-line arguments.
Parse command - line 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=copyproblem.DEFAULT_DATA_DIR,
                      help='''The directory we will load data from and save results to.''')
  parser.add_argument('--debug', type=int, default=0,
                      help='''If 1, print some useful information.''')
  parser.add_argument('--copy_delay', type=int, default=100,
                      help='''The copy delay between presentation time and copy time. Must be divisible by 10.''')
  parser.add_argument('--layer_type', type=str, default='MISTLayer',
                      help='''The RNN layer to use. See `layers`.''')
  parser.add_argument('--activation_type', type=str, default='tanh',
                      help='''An element-wise activation. See `tensorflow.nn`.''')
  parser.add_argument('--num_hidden_units', type=int, default=141,
                      help='''The number of hidden units to use in the recurrent model.''')
  parser.add_argument('--optimizer', type=str, default='ClippingMomentumOptimizer',
                      help='''The Optimizer to use. See `optimizers`.''')
  parser.add_argument('--learning_rate', type=float, default=1.0,
                      help='''The learning rate.''')
  parser.add_argument('--optional_bias_shift', type=float, default=1.0,
                      help='''Used with LSTMLayer and GRULayer. In the case of LSTM, this is
                              more commonly known as forget-gate bias.''')
  parser.add_argument('--num_pre_act_mixture_delays', type=int, default=8,
                      help='''Used only with the MISTLayer.''')
  parser.add_argument('--trial', type=int, default=0,
                      help='''Useful if we'd like to run multiple trials with identical parameters.''')
  args = parser.parse_args()
  args.data_dir = os.path.expanduser(args.data_dir)
  args.pre_act_mixture_delays = 2 ** np.arange(args.num_pre_act_mixture_delays, dtype=np.int)
  params_str = '_'.join([
    '%d' % args.copy_delay,
    '%s' % args.layer_type,
    '%s' % args.activation_type,
    '%04d' % args.num_hidden_units,
    '%.6f' % args.learning_rate,
    '%.1f' % args.optional_bias_shift,
    '%d' % args.num_pre_act_mixture_delays,
    '%02d' % args.trial
  ])
  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 = copyproblem . DEFAULT_DATA_DIR , help = '''The directory we will load data from and save results to.''' ) parser . add_argument ( '--debug' , type = int , default = 0 , help = '''If 1, print some useful information.''' ) parser . add_argument ( '--copy_delay' , type = int , default = 100 , help = '''The copy delay between presentation time and copy time. Must be divisible by 10.''' ) parser . add_argument ( '--layer_type' , type = str , default = 'MISTLayer' , help = '''The RNN layer to use. See `layers`.''' ) parser . add_argument ( '--activation_type' , type = str , default = 'tanh' , help = '''An element-wise activation. See `tensorflow.nn`.''' ) parser . add_argument ( '--num_hidden_units' , type = int , default = 141 , help = '''The number of hidden units to use in the recurrent model.''' ) parser . add_argument ( '--optimizer' , type = str , default = 'ClippingMomentumOptimizer' , help = '''The Optimizer to use. See `optimizers`.''' ) parser . add_argument ( '--learning_rate' , type = float , default = 1.0 , help = '''The learning rate.''' ) parser . add_argument ( '--optional_bias_shift' , type = float , default = 1.0 , help = '''Used with LSTMLayer and GRULayer. In the case of LSTM, this is
                              more commonly known as forget-gate bias.''' ) parser . add_argument ( '--num_pre_act_mixture_delays' , type = int , default = 8 , help = '''Used only with the MISTLayer.''' ) parser . add_argument ( '--trial' , type = int , default = 0 , help = '''Useful if we'd like to run multiple trials with identical parameters.''' ) args = parser . parse_args ( ) args . data_dir = os . path . expanduser ( args . data_dir ) args . pre_act_mixture_delays = 2 ** np . arange ( args . num_pre_act_mixture_delays , dtype = np . int ) params_str = '_' . join ( [ '%d' % args . copy_delay , '%s' % args . layer_type , '%s' % args . activation_type , '%04d' % args . num_hidden_units , '%.6f' % args . learning_rate , '%.1f' % args . optional_bias_shift , '%d' % args . num_pre_act_mixture_delays , '%02d' % args . trial ] ) 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.
Parse command - line arguments .
""" Parse command-line arguments.

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