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.25】为 Paddle 新增 gammaln API #6439

Merged
merged 5 commits into from
Jan 5, 2024
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
2 changes: 2 additions & 0 deletions docs/api/paddle/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ tensor 数学操作
" :ref:`paddle.expm1 <cn_api_paddle_expm1>` ", "逐元素进行 exp(x)-1 运算"
" :ref:`paddle.floor <cn_api_paddle_floor>` ", "向下取整函数"
" :ref:`paddle.floor_divide <cn_api_paddle_floor_divide>` ", "逐元素整除算子,输入 x 与输入 y 逐元素整除,并将各个位置的输出元素保存到返回结果中"
" :ref:`paddle.gammaln <cn_api_paddle_gammaln>` ", "逐元素计算输入 x 的伽马函数的绝对值的自然对数"
" :ref:`paddle.greater_equal <cn_api_paddle_greater_equal>` ", "逐元素地返回 x>=y 的逻辑值"
" :ref:`paddle.greater_than <cn_api_paddle_greater_than>` ", "逐元素地返回 x>y 的逻辑值"
" :ref:`paddle.heaviside <cn_api_paddle_heaviside>` ", "逐元素地对 x 计算由 y 中的对应元素决定的赫维赛德阶跃函数"
Expand Down Expand Up @@ -177,6 +178,7 @@ tensor 数学操作原位(inplace)版本
" :ref:`paddle.exp_ <cn_api_paddle_exp_>` ", "Inplace 版本的 exp API,对输入 x 采用 Inplace 策略"
" :ref:`paddle.flatten_ <cn_api_paddle_flatten_>` ", "Inplace 版本的 flatten API,对输入 x 采用 Inplace 策略"
" :ref:`paddle.floor_ <cn_api_paddle_floor_>` ", "Inplace 版本的 floor API,对输入 x 采用 Inplace 策略"
" :ref:`paddle.gammaln_ <cn_api_paddle_gammaln_>` ", "Inplace 版本的 gammaln API,对输入 x 采用 Inplace 策略"
" :ref:`paddle.reciprocal_ <cn_api_paddle_reciprocal_>` ", "Inplace 版本的 reciprocal API,对输入 x 采用 Inplace 策略"
" :ref:`paddle.round_ <cn_api_paddle_round_>` ", "Inplace 版本的 round API,对输入 x 采用 Inplace 策略"
" :ref:`paddle.rsqrt_ <cn_api_paddle_rsqrt_>` ", "Inplace 版本的 rsqrt API,对输入 x 采用 Inplace 策略"
Expand Down
12 changes: 12 additions & 0 deletions docs/api/paddle/gammaln__cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _cn_api_paddle_gammaln_:

gammaln\_
-------------------------------

.. py:function:: paddle.gammaln_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_gammaln` API,对输入 `x` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位(Inplace)操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位(Inplace)操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3
23 changes: 23 additions & 0 deletions docs/api/paddle/gammaln_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.. _cn_api_paddle_gammaln:

gammaln
-------------------------------

.. py:function:: paddle.gammaln(x, name=None)

逐元素计算伽马函数的绝对值的自然对数。

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

- **x** - 输入 Tensor。数据类型必须为 float16, float32, float64, bfloat16。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
::::::::::::
输出为 Tensor,与 ``x`` 维度相同、数据类型相同。

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

COPY-FROM: paddle.gammaln