Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def augment_parser(parser):
parser.add_argument('--nunits', action='store', dest='nunits',
nargs='?', const=2, type=int, default='512',
help='number of units/layer in MLP')
parser.add_argument('--nhidden', action='store', dest='nhidden',
nargs='?', const=2, type=int, default='2',
help='number of hidden layers in MLP')
return parser
if __name__ == "__main__":
parser = keras_cmdline.create_parser()
parser = augment_parser(parser)
cmdline_args = parser.parse_args()
param_dict = vars(cmdline_args)
run(param_dict)
nargs='?', const=2, type=int, default='16',
help='dimension of capsule')
parser.add_argument('--routings', action='store', dest='routings',
nargs='?', const=2, type=int, default='3',
help='dimension of capsule')
parser.add_argument('--share_weights', action='store', dest='share_weights',
nargs='?', const=1, type=util.str2bool, default=True,
help='boolean. share weights?')
return parser
if __name__ == "__main__":
parser = keras_cmdline.create_parser()
parser = augment_parser(parser)
cmdline_args = parser.parse_args()
param_dict = vars(cmdline_args)
run(param_dict)
def augment_parser(parser):
parser.add_argument('--rnn_type', action='store',
dest='rnn_type',
nargs='?', const=1, type=str, default='LSTM',
choices=['LSTM', 'GRU', 'SimpleRNN'],
help='type of RNN')
parser.add_argument('--nhidden', action='store', dest='nhidden',
nargs='?', const=2, type=int, default='128',
help='number of epochs')
return parser
if __name__ == "__main__":
parser = keras_cmdline.create_parser()
parser = augment_parser(parser)
cmdline_args = parser.parse_args()
param_dict = vars(cmdline_args)
run(param_dict)
help='Filter 2 units')
parser.add_argument('--p_size', action='store', dest='p_size',
nargs='?', const=2, type=int, default='2',
help='pool size')
parser.add_argument('--nunits', action='store', dest='nunits',
nargs='?', const=2, type=int, default='512',
help='number of units in FC layer')
parser.add_argument('--dropout2', type=float, default=0.5,
help='dropout after FC layer')
return parser
if __name__ == "__main__":
parser = keras_cmdline.create_parser()
parser = augment_parser(parser)
cmdline_args = parser.parse_args()
param_dict = vars(cmdline_args)
run(param_dict)
def defaults():
def_parser = keras_cmdline.create_parser()
def_parser = augment_parser(def_parser)
return vars(def_parser.parse_args(''))
parser.add_argument('--hidden_size', action='store', dest='hidden_size',
nargs='?', const=2, type=int, default='1',
help='number of hidden layers')
parser.add_argument('--nunits', action='store', dest='nunits',
nargs='?', const=2, type=int, default='5',
help='number of units per hidden layer')
return parser
def defaults():
def_parser = keras_cmdline.create_parser()
def_parser = augment_parser(def_parser)
return vars(def_parser.parse_args(''))
if __name__ == "__main__":
parser = keras_cmdline.create_parser()
parser = augment_parser(parser)
cmdline_args = parser.parse_args()
param_dict = vars(cmdline_args)
run(param_dict)
parser.add_argument('--embed_hidden_size', action='store', dest='embed_hidden_size',
nargs='?', const=2, type=int, default='50',
help='number of epochs')
parser.add_argument('--sent_hidden_size', action='store', dest='sent_hidden_size',
nargs='?', const=2, type=int, default='100',
help='number of epochs')
parser.add_argument('--query_hidden_size', action='store', dest='query_hidden_size',
nargs='?', const=2, type=int, default='100',
help='number of epochs')
return parser
if __name__ == "__main__":
parser = keras_cmdline.create_parser()
parser = augment_parser(parser)
cmdline_args = parser.parse_args()
param_dict = vars(cmdline_args)
run(param_dict)
#def augment_parser(parser):
# parser.add_argument("--dense", nargs='+', type=int, default=[2000,600])
# parser.add_argument('--minval_uniform', type=float, default=-0.05)
# parser.add_argument('--maxval_uniform', type=float, default=0.05)
# parser.add_argument('--mean_normal', type=float, default=0.0)
# parser.add_argument('--stddev_normal', type=float, default=0.05)
# parser.add_argument("--initialization",
# default='glorot_uniform',
# choices=['constant', 'uniform', 'normal', 'glorot_uniform', 'lecun_uniform', 'lecun_normal', 'he_normal'])
# parser.add_argument("--alpha_dropout", action='store_true',
# help="use AlphaDropout instead of regular Dropout")
#
# return parser
if __name__ == '__main__':
parser = keras_cmdline.create_parser()
#parser = augment_parser(parser)
cmdline_args = parser.parse_args()
param_dict = vars(cmdline_args)
params_p1b1 = initialize_parameters()
param_dict.update(params_p1b1)
param_dict['drop'] = param_dict['dropout']
param_dict['learning_rate'] = param_dict['lr']
run(param_dict)