提交 1e2660a9 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix MakeList to not make an indirect view.

上级 ff9c346e
......@@ -596,7 +596,6 @@ x
class MakeList(Op):
__props__ = ()
def make_node(self, a):
......@@ -615,7 +614,8 @@ class MakeList(Op):
def perform(self, node, inputs, outputs):
(out,) = outputs
out[0] = list(inputs)
# We need to make sure that we don't get a view on our inputs
out[0] = [_lessbroken_deepcopy(inp) for inp in inputs]
make_list = MakeList()
"""
......
......@@ -579,5 +579,5 @@ class TestMakeList(unittest.TestCase):
z = make_list((x, y))
fc = theano.function([a, b], c)
fz = theano.function([x, y], z)
self.assertTrue(fc(A, B) == [A, B])
self.assertTrue(fz(X, Y) == [X, Y])
self.assertTrue((m == n).all() for m, n in zip(fc(A, B), [A, B]))
self.assertTrue((m == n).all() for m, n in zip(fz(X, Y), [X, Y]))
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论