提交 c8c80e81 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

used a cast to avoid another unimplemented sparse operation

上级 3a6581eb
...@@ -2199,6 +2199,11 @@ def mul(x, y): ...@@ -2199,6 +2199,11 @@ def mul(x, y):
if x_is_sparse_variable and y_is_sparse_variable: if x_is_sparse_variable and y_is_sparse_variable:
return mul_s_s(x, y) return mul_s_s(x, y)
elif x_is_sparse_variable and not y_is_sparse_variable: elif x_is_sparse_variable and not y_is_sparse_variable:
# mul is unimplemented if the dtypes differ
if y.dtype == 'float64' and x.dtype == 'float32':
x = x.astype('float64')
return mul_s_d(x, y) return mul_s_d(x, y)
elif y_is_sparse_variable and not x_is_sparse_variable: elif y_is_sparse_variable and not x_is_sparse_variable:
return mul_s_d(y, x) return mul_s_d(y, x)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论