Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Indexing 序号中的共享变量索引错误_Indexing_Gpu_Theano - Fatal编程技术网

Indexing 序号中的共享变量索引错误

Indexing 序号中的共享变量索引错误,indexing,gpu,theano,Indexing,Gpu,Theano,共享变量索引存在问题 列集合的形状是(n,350176),n大于索引 我可以通过以下代码从共享变量train_set_x中获取值 train_set_x.get_value(borrow=True)[index] check = theano.function([index], x, givens = {x : train_set_x[index]}) check(index) 数组([143,142,142.,…,141,141,145.], [ 114., 113., 113., .

共享变量索引存在问题

列集合的形状是(n,350176),n大于索引

我可以通过以下代码从共享变量train_set_x中获取值

train_set_x.get_value(borrow=True)[index]
check = theano.function([index], x, givens = {x : train_set_x[index]})
check(index)
数组([143,142,142.,…,141,141,145.],
[ 114.,  113.,  113., ...,  141.,  141.,  145.],
[108,107,107.,…,139,139,143.],dtype=float32)

但我无法使用以下代码获得值

train_set_x.get_value(borrow=True)[index]
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.
***索引器错误:索引超出范围
应用导致错误的节点:GpuSubtensor{int64}(,ScalarFromTensor.0)
拓扑排序索引:1
输入类型:[cudandaraytype(float32,3D),标量(int64)]
输入形状:[(1039,350176),()]
输入跨步:[(15052850176,1),()]
输入值:[‘未显示’,1039]
输出客户端:[[HostFromGpu(GpuSubtensor{int64}.0)]]
提示:在禁用大多数Theano优化的情况下重新运行可能会返回此节点创建的时间。这可以通过设置Theano标志“optimizer=fast\u compile”来完成。如果不起作用,可以使用“optimizer=None”禁用无优化。
提示:对此应用节点的调试打印和存储映射示意图使用Theano标志“exception\u verbosity=high”。

他们之间有什么区别?那么如何使用列集合x中的值和no.函数呢?

输入值:[“未显示”,1039]显示作为索引参数传递的值(它是1039),
输入形状:[(1039,350176),()][/code>行显示您的
n
是1039

所以看起来你真的像西亚诺说的那样出界了。 以下示例适用于我:

train_set_x = theano.shared(np.random.rand(10, 3, 3))
x = theano.tensor.matrix()
index = theano.tensor.iscalar()
check = theano.function([index], x, givens = {x : train_set_x[index]}
check(3)
检查(10)
显示非常类似的错误:

IndexError: index out of bounds
Apply node that caused the error: Subtensor{int32}(<TensorType(float64, 3D)>, ScalarFromTensor.0)
Toposort index: 1
Inputs types: [TensorType(float64, 3D), Scalar(int32)]
Inputs shapes: [(10, 3, 3), ()]
Inputs strides: [(72, 24, 8), ()]
Inputs values: ['not shown', 10]
Outputs clients: [[DeepCopyOp(Subtensor{int32}.0)]]

HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node
索引器错误:索引超出范围
应用导致错误的节点:子传感器{int32}(,ScalarFromTensor.0)
拓扑排序索引:1
输入类型:[TensorType(float64,3D),Scalar(int32)]
输入形状:[(10,3,3),()]
输入跨步:[(72,24,8),()]
输入值:[‘未显示’,10]
输出客户端:[[DeepCopyOp(子传感器{int32}.0)]]
提示:对此应用节点的调试打印和存储映射示意图使用Theano标志“exception\u verbosity=high”

什么是“x”?它应该是dtype=float32的ftensor3()。x是ano.tensor.tensor3变量。我尝试使用ftensor3,但它不起作用。您能解释一下为什么check(10)抛出错误吗?在给定的示例中,样本数不是10吗?@Shyamkkhadka,是的,它是样本数,但索引是从零开始的,所以最后一个样本的索引是9。