提交 94aa3737 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

implemented connection_pattern and corrected grad for Reshape

上级 4990aaf9
......@@ -5427,10 +5427,14 @@ class Reshape(Op):
raise ValueError('Cannot reshape input of shape %s to shape %s' %
(x.shape, shp))
def connection_pattern(self, node):
return [[True], [False]]
def grad(self, inp, grads):
x, shp = inp
g_out, = grads
return [reshape(g_out, shape(x), ndim=x.ndim), None]
return [reshape(g_out, shape(x), ndim=x.ndim),
DisconnectedType()()]
def R_op(self, inputs, eval_points):
if eval_points[0] is None:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论