示例#1
0
文件: test_op.py 项目: Abioy/Theano
def test_test_value_op():
    try:
        prev_value = config.compute_test_value
        config.compute_test_value = 'raise'
        x = T.log(numpy.ones((5, 5)))
        v = op.get_test_value(x)

        assert numpy.allclose(v, numpy.zeros((5, 5)))
    finally:
        config.compute_test_value = prev_value
示例#2
0
文件: test_op.py 项目: Abioy/Theano
def test_test_value_shared():
    x = shared(numpy.zeros((5, 5)))
    v = op.get_test_value(x)

    assert numpy.all(v == numpy.zeros((5, 5)))
示例#3
0
文件: test_op.py 项目: Abioy/Theano
def test_test_value_ndarray():
    x = numpy.zeros((5, 5))
    v = op.get_test_value(x)
    assert (v == x).all()
示例#4
0
文件: test_op.py 项目: Abioy/Theano
def test_test_value_constant():
    x = T.as_tensor_variable(numpy.zeros((5, 5)))
    v = op.get_test_value(x)

    assert numpy.all(v == numpy.zeros((5, 5)))
示例#5
0
def test_test_value_python_objects():
    for x in (range(3), 0, 0.5, 1):
        assert (op.get_test_value(x) == x).all()
示例#6
0
文件: test_op.py 项目: Abioy/Theano
def test_test_value_python_objects():
    for x in ([0, 1, 2], 0, 0.5, 1):
        assert (op.get_test_value(x) == x).all()
示例#7
0
def test_test_value_constant():
    x = T.as_tensor_variable(numpy.zeros((5, 5)))
    v = op.get_test_value(x)

    assert numpy.all(v == numpy.zeros((5, 5)))
示例#8
0
def test_test_value_ndarray():
    x = numpy.zeros((5, 5))
    v = op.get_test_value(x)
    assert (v == x).all()
示例#9
0
def test_test_value_python_objects():
    for x in (range(3), 0, 0.5, 1):
        assert (op.get_test_value(x) == x).all()
示例#10
0
def test_test_value_shared():
    x = shared(numpy.zeros((5, 5)))
    v = op.get_test_value(x)

    assert numpy.all(v == numpy.zeros((5, 5)))
示例#11
0
def test_test_value_python_objects():
    for x in ([0, 1, 2], 0, 0.5, 1):
        assert (op.get_test_value(x) == x).all()