Skip to content

Commit

Permalink
【Hackathon 5th No.25】为 Paddle 新增 gammaln API (#6439)
Browse files Browse the repository at this point in the history
* 【Hackathon 5th No.25】为 Paddle 新增 gammaln API

* fix

* Update docs/api/paddle/gammaln_cn.rst

Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com>

* fix bug

---------

Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com>
  • Loading branch information
GreatV and sunzhongkai588 authored Jan 5, 2024
1 parent b505c10 commit 94d346d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
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 @@ -179,6 +180,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

0 comments on commit 94d346d

Please sign in to comment.