【发布时间】:2015-06-28 17:51:54
【问题描述】:
我看到下面这行代码:
n_train_batches = train_set_x.get_value(borrow=True).shape[0] / batch_size
在上面一行中,借用参数究竟是什么?在那里添加它有什么好处?仅供参考,train_set_x 基本上是使用 theano.shared 方法生成的矩阵。
【问题讨论】:
标签: python theano deep-learning
我看到下面这行代码:
n_train_batches = train_set_x.get_value(borrow=True).shape[0] / batch_size
在上面一行中,借用参数究竟是什么?在那里添加它有什么好处?仅供参考,train_set_x 基本上是使用 theano.shared 方法生成的矩阵。
【问题讨论】:
标签: python theano deep-learning
This part of the documentation 似乎相关:
默认情况下 (
s_default) 并且当显式设置borrow=False时,我们构造的共享变量会获得 np_array 的 deep 副本。因此,我们随后对np_array所做的更改对我们的共享变量没有影响。
然后可以假设将其设置为 True 以进行浅拷贝,从而有效地让您“借用”内存访问权限。
【讨论】: