(_)
main
main
main
def main(_):
    """
        main
    """
    image_shape = [3, image_size, image_size]
    files = os.listdir(FLAGS.data_path)
    names = [each_item for each_item in files]
    np.random.shuffle(names)
    train_list = names[:9]
    test_list = names[-1]
    tokens, adjvec = utils.load_action(FLAGS.mid)

    model = CIFARModel(tokens, adjvec, image_shape)

    place = fluid.CUDAPlace(0)
    exe = fluid.Executor(place)

    startup = fluid.Program()
    train_prog = fluid.Program()
    test_prog = fluid.Program()
    train_vars = model.build_program(train_prog, startup, True)
    test_vars = model.build_program(test_prog, startup, False)
    exe.run(startup)

    train_accuracy, epoch_id = train(model, FLAGS.early_stop,
                                     train_prog, train_vars, exe, train_list)
    if epoch_id < FLAGS.early_stop:
        utils.dump_reward(FLAGS.mid, train_accuracy)
    else:
        test_accuracy = test(model, test_prog, test_vars, exe, [test_list])
        utils.dump_reward(FLAGS.mid, test_accuracy)
def main ( _ ) : image_shape = [ 3 , image_size , image_size ] files = os . listdir ( FLAGS . data_path ) names = [ each_item for each_item in files ] np . random . shuffle ( names ) train_list = names [ : 9 ] test_list = names [ - 1 ] tokens , adjvec = utils . load_action ( FLAGS . mid ) model = CIFARModel ( tokens , adjvec , image_shape ) place = fluid . CUDAPlace ( 0 ) exe = fluid . Executor ( place ) startup = fluid . Program ( ) train_prog = fluid . Program ( ) test_prog = fluid . Program ( ) train_vars = model . build_program ( train_prog , startup , True ) test_vars = model . build_program ( test_prog , startup , False ) exe . run ( startup ) train_accuracy , epoch_id = train ( model , FLAGS . early_stop , train_prog , train_vars , exe , train_list ) if epoch_id < FLAGS . early_stop : utils . dump_reward ( FLAGS . mid , train_accuracy ) else : test_accuracy = test ( model , test_prog , test_vars , exe , [ test_list ] ) utils . dump_reward ( FLAGS . mid , test_accuracy )