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

【PaddlePaddle Hackathon 2】15、doc for Nanmedian #4820

Merged
merged 3 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api/api_label
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ paddle.max .. _api_paddle_max:
paddle.maximum .. _api_paddle_maximum:
paddle.mean .. _api_paddle_mean:
paddle.median .. _api_paddle_median:
paddle.nanmedian .. _api_paddle_nanmedian:
paddle.min .. _api_paddle_min:
paddle.minimum .. _api_paddle_minimum:
paddle.mm .. _api_paddle_mm:
Expand Down
1 change: 1 addition & 0 deletions docs/api/paddle/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ tensor数学操作
" :ref:`paddle.maximum <cn_api_paddle_tensor_maximum>` ", "逐元素对比输入的两个Tensor,并且把各个位置更大的元素保存到返回结果中"
" :ref:`paddle.mean <cn_api_tensor_cn_mean>` ", "沿 axis 计算 x 的平均值"
" :ref:`paddle.median <cn_api_tensor_cn_median>` ", "沿给定的轴 axis 计算 x 中元素的中位数"
" :ref:`paddle.nanmedian <cn_api_tensor_cn_nanmedian>` ", "沿给定的轴 axis 忽略NAN元素计算 x 中元素的中位数"
" :ref:`paddle.min <cn_api_paddle_tensor_min>` ", "对指定维度上的Tensor元素求最小值运算"
" :ref:`paddle.amin <cn_api_paddle_tensor_min>` ", "对指定维度上的Tensor元素求最小值运算"
" :ref:`paddle.minimum <cn_api_paddle_tensor_minimum>` ", "逐元素对比输入的两个Tensor,并且把各个位置更小的元素保存到返回结果中"
Expand Down
1 change: 1 addition & 0 deletions docs/api/paddle/Tensor/Overview_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ Methods
fmax
mean
median
nanmedian
min
minimum
fmin
Expand Down
9 changes: 9 additions & 0 deletions docs/api/paddle/Tensor_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,15 @@ median(axis=None, keepdim=False, name=None)

请参考 :ref:`cn_api_tensor_cn_median`

nanmedian(axis=None, keepdim=True, name=None)
:::::::::

返回:沿着 ``axis`` 忽略NAN元素进行中位数计算的结果

返回类型:Tensor

请参考 :ref:`cn_api_tensor_cn_nanmedian`

min(axis=None, keepdim=False, name=None)
:::::::::

Expand Down
24 changes: 24 additions & 0 deletions docs/api/paddle/nanmedian_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.. _cn_api_tensor_cn_nanmedian:

nanmedian
-------------------------------

.. py:function:: paddle.nanmedian(x, axis=None, keepdim=True, name=None)

沿给定的轴 ``axis`` 忽略NAN元素计算 ``x`` 中元素的中位数。

参数
::::::::::
- x (Tensor) - 输入的Tensor,数据类型为:float16、float32、float64、int32、int64。
- axis (None|int|list|tuple,可选) - 指定对 ``x`` 进行计算的轴。``axis`` 可以是int或者int元素的列表。``axis`` 值应该在范围[-D, D)内,D是 ``x`` 的维度。如果 ``axis`` 或者其中的元素值小于0,则等价于 :math:`axis + D` 。如果 ``axis`` 是None,则对 ``x`` 的全部元素计算中位数。默认值为None。
- keepdim (bool,可选) - 是否在输出Tensor中保留减小的维度。如果 ``keepdim`` 为True,则输出Tensor和 ``x`` 具有相同的维度(减少的维度除外,减少的维度的大小为1)。否则,输出Tensor的形状会在 ``axis`` 上进行squeeze操作。默认值为True。
- name (str,可选) - 操作的名称(可选,默认值为None)。更多信息请参见 :ref:`api_guide_Name`。

返回
::::::::::
``Tensor`` ,沿着 ``axis`` 忽略NAN元素进行中位数计算的结果。

代码示例
::::::::::
COPY-FROM: paddle.nanmedian:nanmedian-example