Luc*_*uca 6 python theano autoencoder deep-learning
我正在使用安装了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的值.
有人可以帮忙吗?谢谢!
卢卡
In 已被正式弃用,并且有计划的替代品。几天之内,它就从 Theano 开发版本中删除了。但后来我们意识到最好保留它并改变它并摆脱我们计划的替代品。
在那段时间,Theano 想要的和深度学习教程之间也存在一些不一致。
这是固定的。所以现在,更新到 Theano 0.8 或使用 Theano 的当前开发版本,它应该可以正常工作。
也许其他有相关问题的人可能需要更新深度学习教程代码几天,它正在使用我们删除的计划替换。
theano.In() 现在按照您的问题工作。
| 归档时间: |
|
| 查看次数: |
974 次 |
| 最近记录: |