提交 8754eb1f authored 作者: nouiz's avatar nouiz

Merge pull request #1343 from lamblin/fix_rebuild_strict

Always use the value of rebuild_strict
......@@ -479,7 +479,7 @@ def pfunc(params, outputs=None, mode=None, updates=None, givens=None,
in_variables,
replace=givens,
updates=updates,
rebuild_strict=True,
rebuild_strict=rebuild_strict,
copy_inputs_over=True,
no_default_updates=no_default_updates)
# extracting the arguments
......
......@@ -985,6 +985,19 @@ class Test_aliasing_rules(unittest.TestCase):
# objects forming a chain to the underlying data.
class Test_rebuild_strict(unittest.TestCase):
def test1(self):
# Test fix for error reported at
# https://groups.google.com/d/topic/theano-users/BRK0UEB72XA/discussion
w = tensor.imatrix()
x, y = tensor.ivectors('x', 'y')
z = x * y
f = theano.function([w, y], z, givens=[(x, w)], rebuild_strict=False)
z_val = f(numpy.ones((3, 5), dtype='int32'), numpy.arange(5, dtype='int32'))
assert z_val.ndim == 2
assert numpy.all(z_val == numpy.ones((3, 5)) * numpy.arange(5))
if __name__ == '__main__':
theano.config.mode = 'FAST_COMPILE'
Test_pfunc().test_default_scalar_container()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论