【发布时间】:2016-06-23 11:26:53
【问题描述】:
共享变量索引存在问题。
train_set_x的形状为(n, 3, 50176),n大于index
我可以使用以下代码从共享变量 train_set_x 中获取值
train_set_x.get_value(borrow=True)[index]
array([[ 143., 142., 142., ..., 141., 141., 145.],
[ 114., 113., 113., ..., 141., 141., 145.],
[ 108., 107., 107., ..., 139., 139., 143.]], dtype=float32)
但我无法通过以下代码获得价值
check = theano.function([index], x, givens = {x : train_set_x[index]})
check(index)
显示错误信息
*** IndexError: index out of bounds
Apply node that caused the error: GpuSubtensor{int64}(<CudaNdarrayType(float32, 3D)>, ScalarFromTensor.0)
Toposort index: 1
Inputs types: [CudaNdarrayType(float32, 3D), Scalar(int64)]
Inputs shapes: [(1039, 3, 50176), ()]
Inputs strides: [(150528, 50176, 1), ()]
Inputs values: ['not shown', 1039]
Outputs clients: [[HostFromGpu(GpuSubtensor{int64}.0)]]
HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'.
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.
它们之间有什么区别?以及将 train_set_x 中的值与 theano.function 一起使用的方法是什么?
【问题讨论】:
-
什么是'x'?它应该是 dtype=float32 的 ftensor3()。
-
'x' 是 theano.tensor.tensor3 变量。我尝试使用 ftensor3,但没有成功。