提交 b15b8905 authored 作者: Frederic Bastien's avatar Frederic Bastien

'small fix in sparse code. Sometimes it was a numpy matrix that was returned and not an ndarray.'

上级 aca14393
......@@ -650,7 +650,9 @@ class AddSD(gof.op.Op):
broadcastable = y.type.broadcastable).make_variable()])
def perform(self, node, (x, y), (out, )):
assert _is_sparse(x) and _is_dense(y)
out[0] = x + y
# The asarray is needed as in some case, this return a
# numpy.matrixlib.defmatrix.matrix object and not an ndarray.
out[0] = theano._asarray(x + y, dtype=node.outputs[0].type.dtype)
def grad(self, (x, y), (gz,)):
assert _is_sparse_variable(x) and _is_dense_variable(y)
assert _is_dense_variable(gz)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论