【发布时间】:2016-02-02 21:06:59
【问题描述】:
我想在 numpy 中做以下问题试图做的事情:
Numpy matrix multiplication of 2d matrix to give 3d matrix
我已经编写了以下代码(根据 numpy 案例的建议),假设广播也可以在 theano 中工作:
y = T.dmatrix('y')
x = T.dmatrix('x')
z = x[...,None]*y[:,None,:]
但它抛出以下错误:
AsTensorError: ('Cannot convert Ellipsis to TensorType', <type 'ellipsis'>)
【问题讨论】:
-
或者试试
x[:,:,None]*y[:,None,:]。x[...,None]是x[:,:,None]的简写符号/方式。 -
Theano 跟踪器上有一个未解决的问题:github.com/Theano/Theano/issues/2487
-
@Divakar,它正在工作......太棒了!谢谢
-
@Shweta 不错!那么,将带有该评论的答案作为解决方案代码发布?
标签: python numpy matrix theano