提交 2f929289 authored 作者: Frederic Bastien's avatar Frederic Bastien

Clean up and also fix the crash in the code example of gh-4679.

上级 3d665bac
......@@ -191,8 +191,8 @@ class ExtractDiag(Op):
if x.type.ndim != 2:
raise TypeError('ExtractDiag only works on matrices', _x)
return Apply(self, [x], [x.type.__class__(broadcastable=(False,),
dtype=x.type.dtype)()])
y = x.type.clone(broadcastable=(False,))()
return Apply(self, [x], [y])
def perform(self, node, ins, outs):
""" For some reason numpy.diag(x) is really slow, so we
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论