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

【Hackathon No.27】为 Paddle 新增 frac 数学计算API #51

Merged
merged 3 commits into from
Mar 24, 2022
Merged

【Hackathon No.27】为 Paddle 新增 frac 数学计算API #51

merged 3 commits into from
Mar 24, 2022

Conversation

Asthestarsfalll
Copy link
Contributor

为 Paddle 新增 frac 数学计算API

@paddle-bot-old
Copy link

你的PR提交成功,感谢你对开源项目的贡献!
请检查PR提交格式和内容是否完备,具体请参考示例模版
Your PR has been submitted. Thanks for your contribution!
Please check its format and content. For this, you can refer to Template and Demo.

@paddle-bot-old
Copy link

PR格式检查通过,你的PR将接受Paddle专家以及开源社区的review,请及时关注PR动态。
The format inspection passed. Your PR will be reviewed by experts of Paddle and developers from the open-source community. Stay tuned.


## 命名与参数设计

API设计为`paddle.frac(x, name=None)`和tensor.frac(x, name=None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Tensor.frac(x, name=None)


# 二、飞桨现状

飞浆目前并无此API,具体实现可由`trunc`和`elementwise_sub`组合实现。
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • 笔误:飞桨
  • 具体实现可由truncelementwise_sub组合实现。是在python端调这两个的C++ OP呢,还是直接用这两个python组合呢?如果后者的话,接口是paddle.subtract,也可以直接用-

Copy link
Contributor Author

Choose a reason for hiding this comment

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

调用了C++OP,elementwise_sub调用的是_elementwise_op_elementwise_op_in_dygraph

Copy link
Collaborator

Choose a reason for hiding this comment

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

好的,那可以明确说一下是在python端调用C++ Op实现。


## API实现方案

使用`trunc`与`elementwise_sub`组合实现,实现位置为`paddle/tensor/math.py`与`sum`,`nansum`等方法放在一起:
Copy link
Collaborator

Choose a reason for hiding this comment

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

应该和trunc放在一起

@paddle-bot-old
Copy link

你的PR有最新反馈,请及时修改。
There’s the latest feedback about your PR. Please check.

@Asthestarsfalll
Copy link
Contributor Author

已修改完毕

Copy link
Collaborator

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit 1dbd0fe into PaddlePaddle:master Mar 24, 2022
@paddle-bot-old
Copy link

你的PR已合入community库,请进行后续代码开发,并将代码提交至Paddle仓库。
Your PR has been merged into community repository. Please move on coding part and submit your code to corresponding repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants