提交 4675c02e authored 作者: Shawn Tan's avatar Shawn Tan

Removed mentions of nlinalg

上级 f81c9430
...@@ -6385,14 +6385,12 @@ class ExtractDiag(Op): ...@@ -6385,14 +6385,12 @@ class ExtractDiag(Op):
(gz,) = gout (gz,) = gout
if x.ndim == 2: if x.ndim == 2:
# The following code is moved from tensor.nlinalg.ExtractDiag, only
# works for matrices.
x = theano.tensor.zeros_like(x) x = theano.tensor.zeros_like(x)
xdiag = theano.tensor.AllocDiag(offset=self.offset)(gz) xdiag = theano.tensor.AllocDiag(offset=self.offset)(gz)
return [theano.tensor.set_subtensor( return [theano.tensor.set_subtensor(
x[:xdiag.shape[0], :xdiag.shape[1]], xdiag)] x[:xdiag.shape[0], :xdiag.shape[1]], xdiag)]
else: else:
warnings.warn("gradient of theano.tensor.nlinalg.ExtractDiag only" warnings.warn("gradient of theano.tensor.basic.ExtractDiag only"
"works for matrices.") "works for matrices.")
return [grad_not_implemented(self, 0, x)] return [grad_not_implemented(self, 0, x)]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论