def test_strict_mode_ex(self):
n = 10
w = numpy.array([[-1, 2], [3, -4]]).astype(theano.config.floatX)
w_ = theano.shared(w)
x0 = numpy.array([1, 2]).astype(theano.config.floatX)
x0_ = tensor.vector(name='x0', dtype=theano.config.floatX)
def _scan_loose(x):
return tensor.dot(x, w_)
ret_strict = theano.scan(_scan_loose,
sequences=[],
outputs_info=[x0_],
n_steps=n,
strict=True)
f_strict = theano.function([x0_], ret_strict[0][-1])
result_strict = f_strict(x0)
评论列表
文章目录