Example #1
0
def test_write_inputs_no_inputs():
    fname = testdir + input_filename
    write_inputs(((), ()), fname, {})
    file = open(fname)
    s = file.read()
    file.close()
    assert s.strip() == "import numpy as np\ninputs = ()".strip()
Example #2
0
def test_write_inputs():
    fname = testdir + input_filename
    x = theano.tensor.matrix('x', dtype='float32')
    y = theano.tensor.matrix('y', dtype='float32')
    z = x + y
    write_inputs(((x,y), (z,)), fname, {'x': (10, 10), 'y':(10, 10)})
    file = open(fname); s = file.read(); file.close()
    assert s.strip() == ("import numpy as np\n"
    "x = np.random.rand(*(10, 10)).astype('float32')\n"
    "y = np.random.rand(*(10, 10)).astype('float32')\n"
    "inputs = (x, y)").strip()
Example #3
0
def test_write_inputs():
    fname = testdir + input_filename
    x = theano.tensor.matrix('x', dtype='float32')
    y = theano.tensor.matrix('y', dtype='float32')
    z = x + y
    write_inputs(((x, y), (z, )), fname, {'x': (10, 10), 'y': (10, 10)})
    file = open(fname)
    s = file.read()
    file.close()
    assert s.strip() == ("import numpy as np\n"
                         "x = np.random.rand(*(10, 10)).astype('float32')\n"
                         "y = np.random.rand(*(10, 10)).astype('float32')\n"
                         "inputs = (x, y)").strip()
Example #4
0
def test_write_inputs_no_inputs():
    fname = testdir + input_filename
    write_inputs(((), ()), fname, {})
    file = open(fname); s = file.read(); file.close()
    assert s.strip() == "import numpy as np\ninputs = ()".strip()