Skip to content

Conversation

@wanghuancoder
Copy link
Contributor

@wanghuancoder wanghuancoder commented Sep 5, 2022

PR types

New features

PR changes

Others

Describe

添加paddle.autograd.saved_tensors_hooks 模块

@paddle-bot
Copy link

paddle-bot bot commented Sep 5, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

autograd_meta
hook_utils)

cc_library(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里依赖再加一下python,还会有问题吧

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments

std::function<void()> fn_;
};

class PackHookBase {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改名叫:CppVoidPtrHook

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你看一下。这里有两个Hook。给取两个名字吧。

dense_tensor->meta())));
auto pack_hook = SavedTensorsHooks::GetInstance().GetPackHook();
unpack_hook_ = SavedTensorsHooks::GetInstance().GetUnPackHook();
packed_value_ = reinterpret_cast<PyObject*>((*pack_hook)(tensor));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方能用void* 嘛,这样是不是我们可以不依赖Python.h了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saved_tensors_hooks.h里的hook是PyObject*,所以这里是不是PyObject*都需要依赖Python.h。

JiabinYang
JiabinYang previously approved these changes Sep 7, 2022
Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wanghuancoder wanghuancoder changed the title [Eager] SavedTensorsHooks [Eager] saved_tensors_hooks Sep 9, 2022
@wanghuancoder wanghuancoder changed the title [Eager] saved_tensors_hooks [Eager]saved_tensors_hooks Sep 9, 2022
@wanghuancoder wanghuancoder changed the title [Eager]saved_tensors_hooks [Eager] saved_tensors_hooks Sep 9, 2022
@wanghuancoder wanghuancoder changed the title [Eager] saved_tensors_hooks [Eager] saved_tensors_hooks Sep 9, 2022
Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@momozi1996
Copy link
Contributor

LGTM

Copy link
Contributor

@momozi1996 momozi1996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wanghuancoder wanghuancoder merged commit b294f05 into PaddlePaddle:develop Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants