未验证 提交 40f15952 编写于 作者: J Jiabin Yang 提交者: GitHub

fix pylayer name crash (#47323)

上级 076c41ef
......@@ -31,6 +31,7 @@ class GradNodePyLayer : public GradNodeBase {
size_t bwd_out_slot_num)
: GradNodeBase(bwd_in_slot_num, bwd_out_slot_num) {
ctx_ = ctx;
name_ = "GradNodePyLayer_" + std::string(Py_TYPE(ctx_)->tp_name);
Py_INCREF(ctx_);
}
......@@ -52,9 +53,7 @@ class GradNodePyLayer : public GradNodeBase {
void ClearTensorWrappers() override { VLOG(6) << "Do nothing here now"; }
std::string name() override {
return "GradNodePyLayer_" + std::string(Py_TYPE(ctx_)->tp_name);
}
std::string name() override { return name_; }
void SaveForwardOutputsMeta(
const std::vector<std::vector<paddle::experimental::Tensor*>>&
......@@ -84,6 +83,7 @@ class GradNodePyLayer : public GradNodeBase {
private:
PyObject* ctx_{nullptr};
std::string name_{""};
std::vector<std::vector<phi::DenseTensorMeta>> forward_outputs_meta_;
std::vector<std::vector<paddle::platform::Place>> forward_outputs_place_;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册