Skip to content
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

Merged
merged 2 commits into from
Feb 28, 2023

Conversation

jiahy0825
Copy link
Contributor

@jiahy0825 jiahy0825 commented Feb 24, 2023

PR types

New features

PR changes

Others

Describe

  1. After we support C++ Extension and tensor operants overloading, users can use tensor operants in Extension, this PR supports such a mechanism.

  2. 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:

@paddle-bot
Copy link

paddle-bot bot commented Feb 24, 2023

你的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.

zyfncg
zyfncg previously approved these changes Feb 27, 2023
@@ -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();
Copy link
Contributor

Choose a reason for hiding this comment

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

这个如果是强制指定tensor_operants_modephi,函数名里加上PHI看上去会更直观一些

Copy link
Contributor Author

@jiahy0825 jiahy0825 Feb 27, 2023

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,
Copy link
Contributor

Choose a reason for hiding this comment

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

这个接口目前和eager还是绑定的吗?

Copy link
Contributor Author

@jiahy0825 jiahy0825 Feb 27, 2023

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.

@@ -66,5 +69,7 @@ PyObject* ToPyObject(const paddle::experimental::Tensor& value,
return obj;
}

void SwitchTensorOperantsMode() { FLAGS_tensor_operants_mode = "phi"; }
Copy link
Contributor

Choose a reason for hiding this comment

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

这个是不是通过传参控制更灵活一点?

Copy link
Contributor Author

@jiahy0825 jiahy0825 Feb 27, 2023

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.

@jiahy0825 jiahy0825 merged commit 539293e into PaddlePaddle:develop Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants