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

[Autogen Tensor API & Prim-Relevant] Autogen tensor_api.cc #50642

Merged
merged 12 commits into from
Feb 20, 2023

Conversation

jiahy0825
Copy link
Contributor

@jiahy0825 jiahy0825 commented Feb 19, 2023

PR types

New features

PR changes

Others

Describe

Auto-generate tensor operants codes, code example:

tensor_api.cc

// Generated by paddle/phi/api/yaml/generator/tensor_gen.py

#include "paddle/phi/api/include/tensor.h"

#include "paddle/phi/api/include/operants_manager.h"


namespace paddle {

namespace experimental {

Tensor Tensor::operator+(const Tensor &other) const {
  return add(other);
}

Tensor Tensor::add(const Tensor& y) const {
  return paddle::OperantsManager::Instance().add(static_cast<const Tensor &>(*this), y);
}

}  // namespace experimental
}  // namespace paddle

@paddle-bot
Copy link

paddle-bot bot commented Feb 19, 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.

@jiahy0825 jiahy0825 changed the title [Autogen Tensor API] Autogen tensor.h and tensor_api.cc [Autogen Tensor API] Autogen tensor_api.cc Feb 20, 2023
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

@@ -58,6 +58,43 @@ class TensorOperantsBase {

"""

tensor_api_source_include = """// Generated by paddle/phi/api/yaml/generator/tensor_gen.py
Copy link
Contributor

Choose a reason for hiding this comment

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

如果暂时不生成tensor.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.

Next PR fix this.

@jiahy0825 jiahy0825 merged commit c36c719 into PaddlePaddle:develop Feb 20, 2023
@jiahy0825 jiahy0825 changed the title [Autogen Tensor API] Autogen tensor_api.cc [Autogen Tensor API & Prim-Relevant] Autogen tensor_api.cc Feb 23, 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