-
Notifications
You must be signed in to change notification settings - Fork 253
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
【PaddlePaddle Hackathon 4 No.17】为 Paddle 新增 cummax / cummin API #401
Changes from 1 commit
d0b5182
0c610ff
63af315
4abcf39
c0d01ce
6390852
662425e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# paddle.[tensor.]cummin 设计文档 | ||
# paddle.[Tensor.]cummin 设计文档 | ||
|
||
| API名称 | paddle.[Tensor.]cummin | | ||
| ------------------------------------------------------------ | ----------------------------------- | | ||
|
@@ -12,7 +12,7 @@ | |
|
||
## 1、相关背景 | ||
|
||
cummin 是指求累积最小值(cumulative min)的功能。即求 | ||
cummin函数的功能为求累积最小值(cumulative min)。对于输入向量/矩阵,第i个位置的计算方式为: | ||
$$ | ||
y_i = \min(x_1, x_2, x_3, \cdots , x_i) | ||
$$ | ||
|
@@ -21,7 +21,7 @@ PyTorch、NumPy 和 Pandas 提供了相似算子。 | |
|
||
## 2、功能目标 | ||
|
||
cummin API 是一个按轴寻找累计最大值和最大值所在位置的 API。此任务的目标是在 Paddle 框架中,新增 cummin API,调用路径为:`paddle.cummin`和 `paddle.tensor.cummin`。 | ||
cummin API 是一个按轴寻找累计最大值和最大值所在位置的 API。此任务的目标是在 Paddle 框架中,新增 cummin API,调用路径为:`paddle.cummin`和 `paddle.Tensor.cummin`。 | ||
## 3、意义 | ||
|
||
完善矩阵运算的基本功能,增强统计运算完善度。 | ||
|
@@ -265,20 +265,21 @@ PyTorch 还提供了基于 CUDA 的算子实现。 | |
|
||
## 命名与参数设计 | ||
|
||
API设计为`paddle.cummin(x, axis, name)`以及`paddle.tensor.cummin(axis, name)`。 | ||
API设计为`paddle.cummin(x, axis, name)`以及`paddle.Tensor.cummin(axis, name)`。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里也要补上dtype |
||
|
||
paddle.cummin | ||
---------------------- | ||
参数 | ||
::::::::: | ||
- x (Tensor) - 累积最小值的输入,需要进行累积最小值操作的 Tensor。 | ||
- axis (int, 可选) - 指明需要统计的维度。-1代表最后一维。默认:None,将输入展开为一维变量再进行累加计算。 | ||
- name (str,可选) - 具体用法请参见 [Name](https://www.paddlepaddle.org.cn/documentation/docs/zh/api_guides/low_level/program.html#api-guide-name),一般无需设置,默认值为 None。 | ||
- axis (int, 可选) - 指明需要统计的维度。-1代表最后一维。默认:None,将输入展开为一维变量再进行累积最小值计算。 | ||
- dtype (str,可选) - 指定输出索引的数据类型,可以为int32和int64,默认:int64。 | ||
- name (str,可选) - 具体用法请参见 [Name](https://www.paddlepaddle.org.cn/documentation/docs/zh/api_guides/low_level/program.html#api-guide-name),一般无需设置,默认值为 None。 | ||
返回 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 返回索引的api,需要对索引的dtype进行限制,增加一个索引输出的dtype参数吧 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
::::::::: | ||
- Out (tuple) - 返回累积最小值结果和对应的索引信息。结果的数据类型和输入`x`一致。索引的数据类型是 int64。 | ||
- Out (tuple) - 返回累积最小值结果和对应的索引信息。累积最小值结果的数据类型和输入`x`一致。 | ||
|
||
paddle.tensor.cummin指向paddle.cummin,两者是相同的API | ||
paddle.Tensor.cummin指向paddle.cummin,两者是相同的API | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 且返回值中有标的api,需要提供dtype参数,限制返回的下标数据类型(int32, int64),默认为int64 具体参考 https://www.paddlepaddle.org.cn/documentation/docs/zh/dev_guides/api_contributing_guides/api_design_guidelines_standard_cn.html API命名与设计规范 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
## 底层OP设计 | ||
|
||
|
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.
不应该是寻找最大值