2
我要动态地创建面具矩阵,例如,在numpy
更改元素的值的子集在theano矩阵
mask = numpy.zeros((5,5))
row = numpy.arange(5)
col = [0, 2, 3, 0, 1]
mask[row, col] += 1 # that is setting some values to `1`
这是我在theano
试过,
mask = tensor.zeros((5,5))
row = tensor.ivector('row')
col = tensor.ivector('col')
mask = tensor.set_subtensor(mask[row, col], 1)
以上theano
代码失败,并显示错误消息:not supported
。 还有其他方法吗?
对我的作品在'0.6.0'(做'进口theano.tensor为tensor'和复制和粘贴代码)。你到底什么时候会收到错误信息? – eickenberg 2014-10-31 10:14:20
通常'set_subtensor'实际上用作更新。也许你在构建函数时遇到错误?在这种情况下,您能否发布导致此问题的确切代码(包括导入)以及确切的错误消息? – eickenberg 2014-10-31 10:15:52