-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Extension Operants] Extension supports tensor operants #50869
[Extension Operants] Extension supports tensor operants #50869
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
paddle/utils/pybind.h
Outdated
@@ -46,6 +46,9 @@ paddle::experimental::Tensor CastPyArg2Tensor(PyObject* obj, ssize_t arg_pos); | |||
PyObject* ToPyObject(const paddle::experimental::Tensor& value, | |||
bool return_py_none_if_not_initialize = false); | |||
|
|||
// Internal use only, switch tensor_operants_mode to phi | |||
void SwitchTensorOperantsMode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个如果是强制指定tensor_operants_mode
为phi
,函数名里加上PHI看上去会更直观一些
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done
(PyCFunction)(void (*)( | ||
void))eager_api_init_eager_and_static_tensor_operants, | ||
{"_init_tensor_operants", | ||
(PyCFunction)(void (*)(void))eager_api_init_tensor_operants, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个接口目前和eager还是绑定的吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已和 eager 解绑
Unbind this function with eager.
paddle/utils/pybind.cc
Outdated
@@ -66,5 +69,7 @@ PyObject* ToPyObject(const paddle::experimental::Tensor& value, | |||
return obj; | |||
} | |||
|
|||
void SwitchTensorOperantsMode() { FLAGS_tensor_operants_mode = "phi"; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是通过传参控制更灵活一点?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this function can only enable phi mode. Next commit polishes the function name.
PR types
New features
PR changes
Others
Describe
After we support C++ Extension and tensor operants overloading, users can use tensor operants in Extension, this PR supports such a mechanism.
Unbind init_tensor_operants with eager, making the init process of fluid more concise.
Notice: Extension operants use
phi
mode, which enables C++ API without backward.Relevant PRs: