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

增加了top_p_sampling的api说明 #6279

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
25 changes: 25 additions & 0 deletions docs/api/paddle/top_p_sampling_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. _cn_api_paddle_top_p_sampling:

top_p_sampling
-------------------------------

.. py:function:: paddle.top_p_sampling(x, ps, threshold=None, seed=None, name=None)

从累计概率超过某一个阈值 ``ps`` 的词汇中进行采样

参数
:::::::::
- **x** (Tensor) - 输入的多维 ``Tensor`` ,支持的数据类型:float32、float16、bfloat16。
- **ps** (Tensor) - 输入的一维 ``Tensor`` ,长度等于 ``x.shape[0]``,支持的数据类型:float32、float16、bfloat16。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里少了threshold参数,另外参数好像说明不太清楚,除了类型,可以写一下具体用途说明么

- **seed** (int,可选) - 指定随机数种子,默认值为-1。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
:::::::::
tuple(Tensor), 返回 top_p_sampling 的结果和结果的索引信息。结果的数据类型和输入 ``x`` 一致。索引的数据类型是 int64。


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

COPY-FROM: paddle.top_p_sampling