예제 #1
0
def test_read_write_graph():
    x = theano.tensor.matrix('x', dtype='float32')
    y = theano.tensor.matrix('y', dtype='float32')
    z = x + y

    fname = testdir + "test_read_write_fgraph"
    write_graph(((x, y), (z, )), fname)
    fgraph = theano.FunctionGraph((x, y), (z, ))
    fgraph2 = read_graph(fname)
    assert str(fgraph) == str(fgraph2)
    assert isinstance(fgraph2, theano.FunctionGraph)
예제 #2
0
파일: test_util.py 프로젝트: mrocklin/ape
def test_read_write_graph():
    x = theano.tensor.matrix('x', dtype='float32')
    y = theano.tensor.matrix('y', dtype='float32')
    z = x + y

    fname = testdir + "test_read_write_fgraph"
    write_graph(((x,y), (z,)), fname)
    fgraph = theano.FunctionGraph((x,y), (z,))
    fgraph2 = read_graph(fname)
    assert str(fgraph) == str(fgraph2)
    assert isinstance(fgraph2, theano.FunctionGraph)
예제 #3
0
def test_make_scheduler():
    fgraph = read_graph(ape_dir + 'ape/codegen/tests/test.fgraph')
    sched = read_sched(ape_dir + 'ape/codegen/tests/test.sched')
    sched_cmp = sched_to_cmp(sched)
    scheduler = make_scheduler(sched_cmp)
    nodes = scheduler(fgraph)
    nodestrings = map(str, nodes)

    print set(sched) - set(nodestrings)
    assert set(sched).issubset(set(nodestrings))

    indices = map(lambda line: nodestrings.index(line), sched)
    assert sorted(indices) == indices
예제 #4
0
파일: test_util.py 프로젝트: mrocklin/ape
def test_make_scheduler():
    fgraph      = read_graph(ape_dir+'ape/codegen/tests/test.fgraph')
    sched       = read_sched(ape_dir+'ape/codegen/tests/test.sched')
    sched_cmp   = sched_to_cmp(sched)
    scheduler   = make_scheduler(sched_cmp)
    nodes       = scheduler(fgraph)
    nodestrings = map(str, nodes)


    print set(sched) - set(nodestrings)
    assert set(sched).issubset(set(nodestrings))

    indices = map(lambda line: nodestrings.index(line), sched)
    assert sorted(indices) == indices