Example #1
0
def test(expid):
    # to test:
    # OMP_NUM_THREADS=1 THEANO_FLAGS=device=cpu taskset -c 0 python $(expip)/code.py $(expid)
    import os
    os.chdir(expid)
    print "loading data"
    data = GenericClassificationDataset("cifar10", "../cifar_10_shuffled.pkl")

    print "building model"
    model, learn, test = build_model(False)
    print "importing weights"
    shared.importFromFile("weights.pkl")
    print "testing"
    import time
    t0 = time.time()
    test_error, test_cost = data.doTest(test, 50)
    t1 = time.time()
    print "Error, cost, time(s)"
    print test_error, test_cost, t1 - t0
    specialized_test_time = t1 - t0
    normal_test_time = t1 - t0

    f = file("test_results.txt", 'w')
    f.write("specialized:%f\ntheano:%f\nerror:%f\n" %
            (specialized_test_time, normal_test_time, test_error))
    f.close()
Example #2
0
def test(expid):
    # to test:
    # OMP_NUM_THREADS=1 THEANO_FLAGS=device=cpu taskset -c 0 python $(expip)/code.py $(expid)
    import os
    os.chdir(expid)
    print "loading data"
    data = GenericClassificationDataset("cifar10", "../cifar_10_shuffled.pkl")

    print "building model"
    model,learn,test = build_model(False)
    print "importing weights"
    shared.importFromFile("weights.pkl")
    print "testing"
    import time
    t0 = time.time()
    test_error, test_cost = data.doTest(test, 50)
    t1 = time.time()
    print "Error, cost, time(s)"
    print test_error, test_cost, t1-t0
    specialized_test_time = t1-t0
    normal_test_time = t1-t0

    f= file("test_results.txt",'w')
    f.write("specialized:%f\ntheano:%f\nerror:%f\n"%(specialized_test_time, normal_test_time, test_error))
    f.close()