提交 83ac43d3 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

R operator for reshape

上级 6b42efe1
...@@ -4347,6 +4347,13 @@ class Reshape(Op): ...@@ -4347,6 +4347,13 @@ class Reshape(Op):
x, shp = inp x, shp = inp
g_out, = grads g_out, = grads
return [reshape(g_out, shape(x), ndim=x.ndim), None] return [reshape(g_out, shape(x), ndim=x.ndim), None]
def R_op(self, inputs, eval_points):
if eval_points[0] is None:
return [None]
return self.make_node(eval_points[0], *inputs[1:]).outputs
def infer_shape(self, node, ishapes): def infer_shape(self, node, ishapes):
# inputs[1] can contain at most one value of '-1', meaning the actual # inputs[1] can contain at most one value of '-1', meaning the actual
# shape of the output will be automatically computed by reshape, so # shape of the output will be automatically computed by reshape, so
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论