def test_memory_aliasing_updates(self):
x = theano.shared(numpy.array(1))
y = theano.shared(numpy.array(1))
out, updates = theano.scan(
lambda: OrderedDict([(x, x + 1), (y, x)]),
outputs_info=[],
non_sequences=[],
sequences=[],
n_steps=10)
f = theano.function([], [], updates=updates)
f()
assert not numpy.may_share_memory(x.container.storage[0],
y.container.storage[0])
assert x.get_value() != y.get_value()
评论列表
文章目录