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 5th No.17】 为 Paddle 新增 pdist API 中文文档 #6391

Merged
merged 6 commits into from
Dec 18, 2023
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/paddle/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ tensor 线性代数相关
" :ref:`paddle.triu <cn_api_paddle_triu>` ", "返回输入矩阵 input 的上三角部分,其余部分被设为 0"
" :ref:`paddle.triu_indices <cn_api_paddle_triu_indices>` ", "返回输入矩阵在给定对角线右上三角部分元素坐标"
" :ref:`paddle.cdist <cn_api_paddle_cdist>` ", "计算两组输入集合 x, y 中每对之间的 p 范数"
" :ref:`paddle.pdist <cn_api_paddle_pdist>` ", "计算输入形状为 N x M 的 Tensor 中 N 个向量两两组合(pairwise)的 p 范数"

.. _tensor_manipulation:

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

pdist
-------------------------------

.. py:function:: paddle.pdist(x, p=2.0, name=None):

计算输入形状为 N x M 的 Tensor 中 N 个向量两两组合(pairwise)的 p 范数。


参数
::::::::::::

- **x** (Tensor) - 输入的 Tensor,形状为 :math:`N \times M` 。
- **p** (float, 可选) - 计算每个向量对之间的 p 范数距离的值。默认值为 :math:`2.0`。
- **name** (str, 可选) - 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为 None。

返回
::::::::::::
Tensor,数据类型与输入张量相同,输出的形状为 :math:`N \times (N-1) \div 2`。

代码示例
::::::::::::

COPY-FROM: paddle.pdist