Beispiel #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)
Beispiel #2
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)
Beispiel #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
Beispiel #4
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