-
Notifications
You must be signed in to change notification settings - Fork 765
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
修复 paddle.assign 等 API 的文档 #4850
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
96898c9
Update assign_cn.rst
BrilliantYuKaimin 668499b
Update AdaptiveAvgPool1D_cn.rst
BrilliantYuKaimin d819ee7
Update adaptive_avg_pool1d_cn.rst
BrilliantYuKaimin 92695c8
Update XavierNormal_cn.rst
BrilliantYuKaimin ac6b4b3
Update XavierUniform_cn.rst
BrilliantYuKaimin 13b1cb6
Update where_cn.rst
BrilliantYuKaimin 0ac9ea4
Update AdaptiveAvgPool1D_cn.rst
Ligoml 78ff2d3
Update AdaptiveAvgPool1D_cn.rst
BrilliantYuKaimin 9719d05
Update XavierNormal_cn.rst
BrilliantYuKaimin 0ad8aff
Update XavierUniform_cn.rst
BrilliantYuKaimin b0479c8
Update where_cn.rst
BrilliantYuKaimin c6c7195
Update AdaptiveAvgPool1D_cn.rst
BrilliantYuKaimin 01d9d00
Update adaptive_avg_pool1d_cn.rst
BrilliantYuKaimin 4166b46
汇聚->池化
BrilliantYuKaimin 0ab1f51
Update AdaptiveAvgPool1D_cn.rst
BrilliantYuKaimin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,55 +3,37 @@ | |
where | ||
------------------------------- | ||
|
||
.. py:function:: paddle.where(condition, x, y, name=None) | ||
.. py:function:: paddle.where(condition, x=None, y=None, 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. .. py:function:: paddle.where(condition, x=None, y=None, 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. 完成 |
||
|
||
|
||
返回一个根据输入 ``condition``, 选择 ``x`` 或 ``y`` 的元素组成的多维 ``Tensor`` : | ||
根据 ``condition`` 来选择 ``x`` 或 ``y`` 中的对应元素来组成新的 Tensor。具体地, | ||
|
||
.. math:: | ||
Out_i = | ||
\left\{ | ||
\begin{aligned} | ||
&X_i, & & if \ cond_i \ is \ True \\ | ||
&Y_i, & & if \ cond_i \ is \ False \\ | ||
\end{aligned} | ||
\right. | ||
out_i = | ||
\begin{cases} | ||
x_i, & \text{if} \ condition_i \ \text{is} \ True \\ | ||
y_i, & \text{if} \ condition_i \ \text{is} \ False \\ | ||
\end{cases}. | ||
|
||
.. note:: | ||
``numpy.where(condition)`` 功能与 ``paddle.nonzero(condition, as_tuple=True)`` 相同。 | ||
``numpy.where(condition)`` 功能与 ``paddle.nonzero(condition, as_tuple=True)`` 相同,可以参考 :ref:`cn_api_tensor_search_nonzero`。 | ||
|
||
参数 | ||
:::::::::::: | ||
|
||
- **condition** (Tensor)- 选择 ``x`` 或 ``y`` 元素的条件 。为 ``True`` (非零值)时,选择 ``x`` ,否则选择 ``y`` 。 | ||
- **x** (Tensor,Scalar,可选)- 多维 ``Tensor`` 或 ``Scalar``,数据类型为 ``float32`` 或 ``float64`` 或 ``int32`` 或 ``int64`` 。``x`` 和 ``y`` 必须都给出或者都不给出。 | ||
- **y** (Tensor,Scalar,可选)- 多维 ``Tensor`` 或 ``Scalar``,数据类型为 ``float32`` 或 ``float64`` 或 ``int32`` 或 ``int64`` 。``x`` 和 ``y`` 必须都给出或者都不给出。 | ||
- **name** (str,可选)- 操作的名称(可选,默认值为None)。更多信息请参见 :ref:`api_guide_Name`。 | ||
- **condition** (Tensor) - 选择 ``x`` 或 ``y`` 元素的条件。在为 True(非零值)时,选择 ``x``,否则选择 ``y``。 | ||
- **x** (Tensor|scalar,可选) - 条件为 True 时选择的 Tensor 或 scalar,数据类型为 float32、float64、int32 或 int64。``x`` 和 ``y`` 必须都给出或者都不给出。 | ||
- **y** (Tensor|scalar,可选) - 条件为 False 时选择的 Tensor 或 scalar,数据类型为 float32、float64、int32 或 int64。``x`` 和 ``y`` 必须都给出或者都不给出。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
|
||
返回 | ||
:::::::::::: | ||
Tensor,数据类型与 ``x`` 相同的 ``Tensor`` 。 | ||
Tensor,形状与 ``condition`` 相同,数据类型与 ``x`` 和 ``y`` 相同。 | ||
|
||
|
||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
.. code-block:: python | ||
|
||
import paddle | ||
|
||
x = paddle.to_tensor([0.9383, 0.1983, 3.2, 1.2]) | ||
y = paddle.to_tensor([1.0, 1.0, 1.0, 1.0]) | ||
out = paddle.where(x>1, x, y) | ||
|
||
print(out) | ||
#out: [1.0, 1.0, 3.2, 1.2] | ||
|
||
out = paddle.where(x>1) | ||
print(out) | ||
#out: (Tensor(shape=[2, 1], dtype=int64, place=CPUPlace, stop_gradient=True, | ||
# [[2], | ||
# [3]]),) | ||
COPY-FROM: paddle.where:where-example |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
建议同步修改AdaptiveAvgPool2D & adaptive_avg_pool2d、AdaptiveAvgPool3D & adaptive_avg_pool3d,问题是一样的
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.
还是留给接受“池化”这个翻译的同学去修改吧。