예제 #1
0
def rep(iterations, profile):
    options = Options()
    options.serial = True
    options.accperclass = True
    options.convlayers = 0
    options.step = 20
    options.combine = True
    options.representatives = True
    options.post_init()
    x_train, y_train, x_test, y_test = get_dataset(options)  # pylint: disable=unused-variable
    model = train_network(get_model(x_test, options), options)
    only_convolutional, _ = split_network(model, options.convlayers)  # pylint: disable=unused-variable
    cmd_string = """run_experiment(iterations, options, x_train, y_train, x_test, y_test,
                    model, only_convolutional, EXPERIMENT_DIR + '/representatives.csv')"""
    if profile:
        cProfile.run(cmd_string, PROFILING_DIR + '/representatives')
    else:
        exec(cmd_string)
예제 #2
0
def constraint(iterations, profile):
    delete = True
    if delete:
        remove_caches()
    options = Options()
    options.serial = True
    options.convlayers = 3
    options.step = 20
    options.combine = False
    options.representatives = False
    options.post_init()
    options.model_step = 20
    x_train, y_train, x_test, y_test = get_dataset(options)  # pylint: disable=unused-variable
    model = train_network(get_model(x_test, options), options)
    options.convlayers = get_last_conv_layer(model) + 1
    only_convolutional, _ = split_network(model, options.convlayers)
    cmd_string = """run_experiment(iterations, options, x_train, y_train, x_test, y_test,
                    model, only_convolutional, EXPERIMENT_DIR + '/constraint.csv')"""
    if profile:
        cProfile.run(cmd_string, PROFILING_DIR + '/constraint')
    else:
        exec(cmd_string)