【发布时间】:2016-04-23 17:45:20
【问题描述】:
我可以看到使用 numpy 的逐元素矩阵乘法可以使用 * 运算符完成。
print np.mat(np.ones((10,10)))*np.mat(np.ones((10,10)))
但无法让它在 theano 下工作。我试过的代码是
x = T.dmatrix('x')
y = T.dmatrix('y')
z = x * y
f1 = theano.function([x, y], z)
print f1(np.mat(np.ones((10,10))),np.mat(np.ones((10,10))))
【问题讨论】:
-
如果你只想要元素乘法,把
z = x + y改成z = x * y。 -
@ajcr 这是*。 + 是错误的。已更正
-
该代码对我有用(产生一个 10 x 10 的 1 数组),你看到了什么结果?
标签: python numpy theano theano-cuda