我正在使用安装了Theano库的Python 2.7(更新版本),我对输入参数有问题,定义了Theano函数.
代码是:
corruption_level = T.scalar('corruption') # % of corruption to use
learning_rate = T.scalar('lr') # learning rate to use
fn = theano.function(
inputs=[
index,
theano.In(corruption_level, value=0.2),
theano.In(learning_rate, value=0.1)
],
outputs=cost,
updates=updates,
givens={
self.x: train_set_x[batch_begin: batch_end]
}
)
Run Code Online (Sandbox Code Playgroud)
它取自这里:
http://deeplearning.net/tutorial/code/SdA.py
它给了我这个错误,使用Eclipse:
NotImplementedError: In() instances and tuple inputs trigger the old
semantics, which disallow using updates and givens
Run Code Online (Sandbox Code Playgroud)
所以,如果我以这种方式更改代码:
fn = theano.function(
inputs=[
index,
#theano.In(corruption_level, value=0.2),
#theano.In(learning_rate, value=0.1)
corruption_level,
learning_rate
],
outputs=cost,
updates=updates,
givens={
self.x: train_set_x[batch_begin: batch_end]
}
)
Run Code Online (Sandbox Code Playgroud)
它有效,但我无法传递corruption_level和learning_rate的值.
有人可以帮忙吗?谢谢! …