未验证 提交 1f6d25d8 编写于 作者: B BrilliantYuKaimin 提交者: GitHub

修复 paddle.bernoulli 英文文档 (#42912)

* Update random.py

* test=document_fix

* test=document_fix

* Update random.py
上级 67b9b51b
...@@ -30,25 +30,24 @@ __all__ = [] ...@@ -30,25 +30,24 @@ __all__ = []
def bernoulli(x, name=None): def bernoulli(x, name=None):
""" """
Returns a Tensor filled with random binary(0 or 1) number from a Bernoulli distribution. For each element :math:`x_i` in input ``x``, take a sample from the Bernoulli distribution, also called two-point distribution, with success probability :math:`x_i`. The Bernoulli distribution with success probability :math:`x_i` is a discrete probability distribution with probability mass function
The input ``x`` is a tensor with probabilities for generating the random binary number.
Each element in ``x`` should be in [0, 1], and the out is generated by:
.. math:: .. math::
p(y)=\\begin{cases}
out_i ~ Bernoulli (x_i) x_i,&y=1\\\\
1-x_i,&y=0
\end{cases}.
Args: Args:
x(Tensor): A tensor with probabilities for generating the random binary number. The data type x (Tensor): The input Tensor, it's data type should be float32, float64.
should be float32, float64. name (str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
name(str, optional): The default value is None. Normally there is no
need for user to set this property. For more information, please
refer to :ref:`api_guide_Name`.
Returns: Returns:
Tensor: A Tensor filled with random binary number with the same shape and dtype as ``x``. Tensor: A Tensor filled samples from Bernoulli distribution, whose shape and dtype are same as ``x``.
Examples: Examples:
.. code-block:: python .. code-block:: python
:name: bernoulli-example
import paddle import paddle
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册