!37160 fix bernoulli code docs
Merge pull request !37160 from jiangshuqiang/code_docs_bernoulli
This commit is contained in:
commit
c117c0648c
|
@ -170,7 +170,7 @@ mindspore.Tensor
|
|||
**参数:**
|
||||
|
||||
- **p** (Union[Tensor, float], 可选) - shape需要可以被广播到当前Tensor。其数据类型为float32或float64。`p` 中每个值代表输出Tensor中对应广播位置为1的概率,数值范围在0到1之间。默认值:0.5。
|
||||
- **seed** (int, 可选) - 随机种子,用于生成随机数,数值范围是正数,默认取当前时间。默认值:-1。
|
||||
- **seed** (int, 可选) - 随机种子,用于生成随机数,数值范围是-1或正整数。默认值:-1,代表取当前时间戳。
|
||||
|
||||
**返回:**
|
||||
|
||||
|
@ -179,9 +179,9 @@ mindspore.Tensor
|
|||
**异常:**
|
||||
|
||||
- **TypeError** - 当前Tensor的数据类型不在int8, uint8, int16, int32,int64,bool, float32和float64中。
|
||||
- **TypeError** - `p` 的数据类型既不是float16也不是float32。
|
||||
- **TypeError** - `p` 的数据类型既不是float32也不是float64。
|
||||
- **TypeError** - `seed` 不是int。
|
||||
- **ValueError** - `seed` 是负数。
|
||||
- **ValueError** - `seed` 是负数且不为-1。
|
||||
- **ValueError** - `p` 数值范围不在0到1之间。
|
||||
|
||||
.. py:method:: bitwise_and(x)
|
||||
|
|
|
@ -13,7 +13,7 @@ mindspore.ops.bernoulli
|
|||
|
||||
- **x** (Tensor) - 任意维度的Tensor,其数据类型为int8, uint8, int16, int32,int64,bool, float32或float64。
|
||||
- **p** (Union[Tensor, float], optional) - shape需要可以被广播到当前Tensor。其数据类型为float32或float64。`p` 中每个值代表输出Tensor中对应广播位置为1的概率,数值范围在0到1之间。默认值:0.5。
|
||||
- **seed** (int, optional) - 随机种子,用于生成随机数,数值范围是正数,默认取当前时间。默认值:-1。
|
||||
- **seed** (int, optional) - 随机种子,用于生成随机数,数值范围是-1或正整数。默认值:-1,代表取当前时间戳。
|
||||
|
||||
**返回:**
|
||||
|
||||
|
@ -22,7 +22,7 @@ mindspore.ops.bernoulli
|
|||
**异常:**
|
||||
|
||||
- **TypeError** - `x` 的数据类型不在int8、uint8、int16、int32、int64、bool、float32和float64中。
|
||||
- **TypeError** - `p` 的数据类型既不是float16也不是float32。
|
||||
- **TypeError** - `p` 的数据类型既不是float32也不是float64。
|
||||
- **TypeError** - `seed` 不是int。
|
||||
- **ValueError** - `seed` 是负数。
|
||||
- **ValueError** - `seed` 是负数且不为-1。
|
||||
- **ValueError** - `p` 数值范围不在0到1之间。
|
||||
|
|
|
@ -3767,20 +3767,22 @@ class Tensor(Tensor_):
|
|||
out_{i} \sim Bernoulli(p_{i})
|
||||
|
||||
Args:
|
||||
p (Union[Tensor, float], optional): The shape of p need to be broadcast. The elements of p represent the
|
||||
probability of setting 1 for the corresponding broadcast position of
|
||||
the current Tensor. Default: 0.5.
|
||||
seed (int, optional): The seed value for random generating. Default: -1.
|
||||
p (Union[Tensor, float], optional): The shape of p need to be broadcast. Data type must be float32 or
|
||||
float64. The elements of p represent the probability of setting 1 for
|
||||
the corresponding broadcast position of the current Tensor. The value
|
||||
of `p` must be in the range `[0, 1]`. Default: 0.5.
|
||||
seed (int, optional): The seed value for random generating. The value of `seed` must be -1 or a positive
|
||||
integer. Default: -1, which means using the current timestamp.
|
||||
|
||||
Returns:
|
||||
Tensor, with the same shape and type as x.
|
||||
output (Tensor), with the same shape and type as x.
|
||||
|
||||
Raises:
|
||||
TypeError: If dtype of Tensor is not one of: int8, uint8, int16, int32,int64,bool, float32, float64.
|
||||
TypeError: If dtype of Tensor is not one of: int8, uint8, int16, int32, int64, bool, float32, float64.
|
||||
TypeError: If dtype of `p` is not one of: float32, float64.
|
||||
TypeError: If dtype of `seed` is not an int.
|
||||
TypeError: If dtype of `seed` is not int.
|
||||
ValueError: If `p` is not in range [0, 1].
|
||||
ValueError: If `seed` is less than 0.
|
||||
ValueError: If `seed` is less than 0 and not -1.
|
||||
|
||||
Supported Platforms:
|
||||
``GPU``
|
||||
|
|
|
@ -3382,21 +3382,23 @@ def bernoulli(x, p=0.5, seed=-1):
|
|||
|
||||
Args:
|
||||
x (Tensor): Tensor of shape :math:`(N,*)` where :math:`*` means, any number of additional dimensions. Data
|
||||
type must be int8, uint8, int16, int32,int64,bool, float32 or float64。
|
||||
p (Union[Tensor, float], optional): The shape of p need to be broadcast. The elements of p represent the
|
||||
probability of setting 1 for the corresponding broadcast position of
|
||||
the current Tensor. Default: 0.5.
|
||||
seed (int, optional): The seed value for random generating. Default: -1.
|
||||
type must be int8, uint8, int16, int32, int64, bool, float32 or float64.
|
||||
p (Union[Tensor, float], optional): The shape of p need to be broadcast. Data type must be float32 or float64.
|
||||
The elements of p represent the probability of setting 1 for the
|
||||
corresponding broadcast position of the current Tensor. The value of `p`
|
||||
must be in the range `[0, 1]`. Default: 0.5.
|
||||
seed (int, optional): The seed value for random generating. The value of `seed` must be -1 or a positive
|
||||
integer. Default: -1, which means using the current timestamp.
|
||||
|
||||
Returns:
|
||||
Tensor, with the same shape and type as x.
|
||||
output (Tensor), with the same shape and type as x.
|
||||
|
||||
Raises:
|
||||
TypeError: If `seed` is not an int.
|
||||
TypeError: If dtype of `input` is not one of: int8, uint8, int16, int32,int64,bool, float32, float64.
|
||||
TypeError: If dtype of `input` is not one of: float32, float64.
|
||||
TypeError: If dtype of `x` is not one of: int8, uint8, int16, int32, int64, bool, float32, float64.
|
||||
TypeError: If dtype of `p` is not one of: float32, float64.
|
||||
TypeError: If dtype of `seed` is not int.
|
||||
ValueError: If `p` is not in range [0, 1].
|
||||
ValueError: If `seed` is less than 0.
|
||||
ValueError: If `seed` is less than 0 and not -1.
|
||||
|
||||
Supported Platforms:
|
||||
``GPU``
|
||||
|
|
Loading…
Reference in New Issue