Skip to content

Commit

Permalink
【PaddlePaddle Hackathon 4 No.23】新增 API vander (#5681)
Browse files Browse the repository at this point in the history
* first commit of paddle.vander doc

* fix code style error

* fix copy from

* fix error

* 修复参数命名为小写

* 修改
  • Loading branch information
Li-fAngyU authored Mar 31, 2023
1 parent 397066d commit 3e86bbc
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/api/api_label
Original file line number Diff line number Diff line change
Expand Up @@ -1212,4 +1212,6 @@ paddle.bernoulli .. _api_paddle_bernoulli:
paddle.uniform .. _api_paddle_uniform:
paddle.get_cuda_rng_state .. _api_paddle_get_cuda_rng_state:
paddle.flops .. _api_paddle_flops:
paddle.load .. _api_paddle_load:
paddle.load .. _api_paddle_load:
paddle.vander .. _api_paddle_vander:

1 change: 1 addition & 0 deletions docs/api/paddle/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ tensor 创建相关
" :ref:`paddle.clone <cn_api_tensor_clone>` ", "对输入 Tensor ``x`` 进行拷贝,并返回一个新的 Tensor,并且该操作提供梯度回传"
" :ref:`paddle.batch <cn_api_paddle_batch>` ", "一个 reader 的装饰器。返回的 reader 将输入 reader 的数据打包成指定的 batch_size 大小的批处理数据(不推荐使用)"
" :ref:`paddle.polar <cn_api_paddle_polar>`", "对于给定的模 ``abs`` 和相位角 ``angle``,返回一个对应复平面上的坐标复数 Tensor"
" :ref:`paddle.vander <cn_api_paddle_vander>` ", "生成范德蒙德矩阵。"

.. _tensor_search:

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 @@ -275,3 +275,4 @@ Methods
frexp
trapezoid
cumulative_trapezoid
vander
11 changes: 11 additions & 0 deletions docs/api/paddle/Tensor_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2515,3 +2515,14 @@ polar(abs, angle)
返回类型:Tensor

请参考 :ref:`cn_api_paddle_polar`

vander(x, n=None, increasing=False, name=None)
:::::::::

生成范德蒙德矩阵, 默认生成维度为 (x.shape[0],x.shape[0]) 且降序的范德蒙德矩阵。其中输入 x 必须为 1-D Tensor。输入 n 为矩阵的列数。输入 increasing 决定了矩阵的升降序,默认为降序。

返回:返回一个根据 n 和 increasing 创建的范德蒙德矩阵。

返回类型:Tensor

请参考 :ref:`cn_api_paddle_vander`
25 changes: 25 additions & 0 deletions docs/api/paddle/vander_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. _cn_api_paddle_vander:

vander
-------------------------------

.. py:function:: paddle.vander(x, n=None, increasing=False, name=None)
生成范德蒙德矩阵。

输出矩阵的每一列都是输入向量的幂。 幂的顺序由递增的布尔参数确定。 具体而言,当递增为 “false” 时,第 i 个输出列是输入向量元素顺序的升序,其幂为 N-i-1。 每行都有等比级数的这样一个矩阵称为 Alexandre-Theophile Vandermonde 矩阵。

参数
::::::::::
- **x** (Tensor) - 输入的 Tensor,必须是 1-D Tensor, 支持的数据类型:int32、int64、float32、float64、complex64、complex128。
- **n** (int,可选) - 输出中的列数。如果未指定 n,则返回一个方阵(n = len(x))。
- **increasing** (bool,可选) - 列的幂次顺序。如果为 True,则幂次从左到右增加,如果为 False(默认值),则幂次顺序相反。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
::::::::::
返回一个根据 n 和 increasing 创建的范德蒙德矩阵。

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

COPY-FROM: paddle.vander

0 comments on commit 3e86bbc

Please sign in to comment.