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 3】16 新增 API paddle.take #5099
Changes from 5 commits
e5c7771
c40cb85
498c668
1d37f73
6d7633e
b8fdee5
a555df0
6aada7e
013d01f
93cf5a6
e2d5299
68f3627
f6239a7
12b3da6
9b24ee2
67f3e60
f87a792
4404d50
6cbc27c
677189d
38801a1
083cf1a
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 |
---|---|---|
|
@@ -246,6 +246,7 @@ Methods | |
subtract_ | ||
sum | ||
t | ||
take | ||
tanh | ||
tanh_ | ||
tile | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2412,3 +2412,12 @@ erfinv(x, name=None) | |
对输入 x 进行逆误差函数计算 | ||
|
||
请参考 :ref:`cn_api_paddle_tensor_erfinv` | ||
|
||
take(input, index, 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. 作为 Tensor 的方法应该不需要第一个参数~ 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 |
||
::::::::: | ||
|
||
返回:一个新的 Tensor,其中包含给定索引处的输入元素。结果与 `index` 的形状相同 | ||
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. 这里还有一个用 ` 包裹的,也许我们应该用 :attr:`arg_name` 这样?目前 Paddle 文档中引用某一个参数经常会使用这个,比如 argmax 源码和渲染分别为 这里看起来虽然与普通行内代码块一样,但应该仅仅是 Paddle 前端没有为两者样式做区分,比如 sphinx-rtd-theme 两者区别就是比较明显的 @BrilliantYuKaimin 有什么建议嘛? 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. 在 rst 中用一个 ` 包裹的表示斜体,用两个 ` 包裹的表示代码块。既然 :attr:`arg_name` 和 ``arg_name`` 确实可以渲染出不同的效果,那么当然应该使用 :attr:`arg_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. Thx,Done 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. 「仅仅是 Paddle 前端没有为两者样式做区分」 |
||
|
||
返回类型:Tensor | ||
|
||
请参考 :ref:`cn_api_tensor_take` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.. _cn_api_paddle_tensor_take: | ||
|
||
take | ||
------------------------------- | ||
|
||
.. py:function:: paddle.take(input, index, name=None) | ||
|
||
返回一个新的 Tensor,其中包含给定索引处的输入元素。 | ||
将输入 Tensor 视为一维 Tensor,返回指定索引上的元素集合,返回结果与 `index` 的形状相同。 | ||
|
||
参数 | ||
::::::::: | ||
|
||
- **input** (Tensor) - 输入的 Tensor,支持 int32、int64、float32、float64 数据类型。 | ||
- **index** (Tensor) - 索引矩阵,支持 int32、int64 数据类型。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
|
||
返回 | ||
::::::::: | ||
|
||
- Tensor - 返回一个新的 Tensor,其中包含给定索引处的输入元素。结果与 index 的形状相同。 | ||
S-HuaBomb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
代码示例 | ||
::::::::: | ||
|
||
|
||
COPY-FROM: paddle.take | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
.. _cn_api_paddle_vision_models_alexnet: | ||
.. _cn_api_paddle_vision_models_AlexNet: | ||
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. 注意不要把没有修改的文件提交了哦,这是 PaddlePaddle/Paddle#44671 提到的问题,暂时还没办法解决,也确实容易误操作,不过暂时先自己注意一下吧~如果可以的话尽可能恢复下~(大小写不敏感文件系统可能不太好处理,如果不能直接恢复的话,可以试试比如 revert 的命令来恢复,实在不行的话只能重新提 PR 了) 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. Thx,Done 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. 这个问题现在有团队在解决了,预期Q3完成~ |
||
|
||
alexnet | ||
AlexNet | ||
------------------------------- | ||
|
||
.. py:function:: paddle.vision.models.alexnet(pretrained=False, **kwargs) | ||
.. py:function:: paddle.vision.models.AlexNet(num_classes=1000) | ||
|
||
|
||
AlexNet 模型,来自论文 `"ImageNet Classification with Deep Convolutional Neural Networks" <https://papers.nips.cc/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf>`_ 。 | ||
|
||
参数 | ||
::::::::: | ||
|
||
- **pretrained** (bool,可选) - 是否加载预训练权重。如果为 True,则返回在 ImageNet 上预训练的模型。默认值为 False。 | ||
- **\*\*kwargs** (可选) - 附加的关键字参数,具体可选参数请参见 :ref:`AlexNet <cn_api_paddle_vision_models_AlexNet>`。 | ||
- **num_classes** (int,可选) - 最后一个全连接层输出的维度。如果该值小于等于 0,则不定义最后一个全连接层。默认值为 1000。 | ||
|
||
返回 | ||
::::::::: | ||
|
@@ -22,4 +21,4 @@ AlexNet 模型,来自论文 `"ImageNet Classification with Deep Convolutional | |
代码示例 | ||
::::::::: | ||
|
||
COPY-FROM: paddle.vision.models.alexnet | ||
COPY-FROM: paddle.vision.models.AlexNet |
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.
Thx,done