From 14536d0f644f9f2aa5ad890e211ed02bdcb4a6db Mon Sep 17 00:00:00 2001 From: Jiabin Yang <360788950@qq.com> Date: Wed, 26 Oct 2022 10:22:49 +0800 Subject: [PATCH] fix pylayer copy error (#47154) --- paddle/fluid/eager/pylayer/py_layer_node.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paddle/fluid/eager/pylayer/py_layer_node.h b/paddle/fluid/eager/pylayer/py_layer_node.h index 8c93eb944f7..eb8d1bc9c57 100644 --- a/paddle/fluid/eager/pylayer/py_layer_node.h +++ b/paddle/fluid/eager/pylayer/py_layer_node.h @@ -34,6 +34,13 @@ class GradNodePyLayer : public GradNodeBase { Py_INCREF(ctx_); } + GradNodePyLayer(const GradNodePyLayer& other) : GradNodeBase(other) { + this->ctx_ = other.ctx_; + Py_INCREF(this->ctx_); + this->forward_outputs_meta_ = other.forward_outputs_meta_; + this->forward_outputs_place_ = other.forward_outputs_place_; + } + ~GradNodePyLayer() override; virtual paddle::small_vector, -- GitLab