提交 d2886df7 authored 作者: Tim Cooijmans's avatar Tim Cooijmans

map_variables: avoid replacement with different dtype in tests

上级 0e86e3e1
...@@ -62,7 +62,9 @@ class TestMapVariables(unittest.TestCase): ...@@ -62,7 +62,9 @@ class TestMapVariables(unittest.TestCase):
# imports them into the inner graph properly, and map_variables() # imports them into the inner graph properly, and map_variables()
# should do this as well. # should do this as well.
outer = tensor.scalar("outer") outer = tensor.scalar("outer")
shared = theano.shared(1, name="shared") shared = theano.shared(
numpy.array(1., dtype=theano.config.floatX),
name="shared")
constant = tensor.constant(1, name="constant") constant = tensor.constant(1, name="constant")
# z will equal 1 so multiplying by it doesn't change any values # z will equal 1 so multiplying by it doesn't change any values
...@@ -133,8 +135,11 @@ class TestMapVariables(unittest.TestCase): ...@@ -133,8 +135,11 @@ class TestMapVariables(unittest.TestCase):
# as with the scan tests above, insert foreign inputs into the # as with the scan tests above, insert foreign inputs into the
# inner graph. # inner graph.
outer = tensor.scalar("outer") outer = tensor.scalar("outer")
shared = theano.shared(1, name="shared") shared = theano.shared(
constant = tensor.constant(1, name="constant") numpy.array(1., dtype=theano.config.floatX),
name="shared")
constant = tensor.constant(1., name="constant")
print [x.dtype for x in [outer, shared, constant]]
z = outer * (shared + constant) z = outer * (shared + constant)
# construct the inner graph # construct the inner graph
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论