提交 8b9b6a69 authored 作者: Razvan Pascanu's avatar Razvan Pascanu 提交者: David Warde-Farley

added a new test for generic tensors

上级 a80ee01a
...@@ -37,6 +37,17 @@ class test_ifelse(unittest.TestCase): ...@@ -37,6 +37,17 @@ class test_ifelse(unittest.TestCase):
assert numpy.allclose(vx, f(1, vx, vy)) assert numpy.allclose(vx, f(1, vx, vy))
assert numpy.allclose(vy, f(0, vx, vy)) assert numpy.allclose(vy, f(0, vx, vy))
def test_lazy_if_on_generics(self):
x = theano.generic()
y = theano.generic()
c = tensor.iscalar('c')
f = theano.function([c, x, y], ifelse(c, x, y))
vx = ['testX']
vy = ['testY']
assert f(1, vx, vy) == vx
assert f(0, vx, vy) == vy
def test_grad_lazy_if(self): def test_grad_lazy_if(self):
# Tests that we can compute the gradients through lazy if # Tests that we can compute the gradients through lazy if
x = tensor.vector('x') x = tensor.vector('x')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论