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 No.28] add logcumsumexp docs #4807

Merged
merged 4 commits into from
Jun 10, 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/paddle/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ tensor数学操作
" :ref:`paddle.log <cn_api_fluid_layers_log>` ", "Log激活函数(计算自然对数)"
" :ref:`paddle.log10 <cn_api_paddle_tensor_math_log10>` ", "Log10激活函数(计算底为10的对数)"
" :ref:`paddle.log2 <cn_api_paddle_tensor_math_log2>` ", "计算Log1p(加一的自然对数)结果"
" :ref:`paddle.logcumsumexp <cn_api_paddle_tensor_math_logsumexp>` ", "计算 x 的指数的前缀和的对数"
" :ref:`paddle.logical_and <cn_api_fluid_layers_logical_and>` ", "逐元素的对 x 和 y 进行逻辑与运算"
" :ref:`paddle.logical_not <cn_api_fluid_layers_logical_not>` ", "逐元素的对 X Tensor进行逻辑非运算"
" :ref:`paddle.logical_or <cn_api_fluid_layers_logical_or>` ", "逐元素的对 X 和 Y 进行逻辑或运算"
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 @@ -162,6 +162,7 @@ Methods
log10
log1p
log2
logcumsumexp
logical_and
logical_not
logical_or
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 @@ -1355,6 +1355,15 @@ log1p(name=None)

请参考 :ref:`cn_api_paddle_tensor_log1p`

logcumsumexp(x, axis=None, dtype=None, name=None)
:::::::::

返回:计算后的Tensor

返回类型:Tensor

请参考 :ref:`cn_api_paddle_tensor_logcumsumexp`

logical_and(y, out=None, name=None)
:::::::::

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

logcumsumexp
-------------------------------

.. py:function:: paddle.logcumsumexp(x, axis=None, dtype=None, name=None)

计算 x 的指数的前缀和的对数。

.. note::
结果的第一个元素和输入的第一个元素相同。

假设输入是二维矩阵,j 是 axis 维的下标,i 是另一维的下标,那么运算结果将是

.. math::

logcumsumexp(x)_{ij} = log \sum_{i=0}^{j}exp(x_{ij})

参数
:::::::::
- **x** (Tensor) - 需要进行操作的Tensor。
- **axis** (int,可选) - 指明需要计算的维度。-1代表最后一维。默认:None,将输入展开为一维变量再进行计算。
- **dtype** (str,可选) - 输出Tensor的数据类型,支持float32、float64. 如果指定了,那么在执行操作之前,输入张量将被转换为dtype. 这对于防止数据类型溢出非常有用。默认为:None。
- **name** (str,可选)- 操作的名称(可选,默认值为None)。更多信息请参见 :ref:`api_guide_Name` 。

返回
:::::::::
- Tensor (Tensor),x 的指数的前缀和的对数。


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

COPY-FROM: paddle.logcumsumexp