Restrict the range of the parameters in random ops

This commit is contained in:
peixu_ren 2020-09-14 16:50:50 -04:00
parent a92e444f21
commit 54d38e4d13
2 changed files with 9 additions and 8 deletions

View File

@ -49,7 +49,8 @@ def normal(shape, mean, stddev, seed=0):
shape (tuple): The shape of random tensor to be generated. shape (tuple): The shape of random tensor to be generated.
mean (Tensor): The mean μ distribution parameter, which specifies the location of the peak. mean (Tensor): The mean μ distribution parameter, which specifies the location of the peak.
With float32 data type. With float32 data type.
stddev (Tensor): The deviation σ distribution parameter. With float32 data type. stddev (Tensor): The deviation σ distribution parameter. It should be greater than 0.
With float32 data type.
seed (int): Seed is used as entropy source for Random number engines generating pseudo-random numbers. seed (int): Seed is used as entropy source for Random number engines generating pseudo-random numbers.
Must be non-negative. Default: 0. Must be non-negative. Default: 0.
@ -136,8 +137,8 @@ def gamma(shape, alpha, beta, seed=0):
Args: Args:
shape (tuple): The shape of random tensor to be generated. shape (tuple): The shape of random tensor to be generated.
alpha (Tensor): The alpha α distribution parameter. With float32 data type. alpha (Tensor): The alpha α distribution parameter. It should be greater than 0. With float32 data type.
beta (Tensor): The beta β distribution parameter. With float32 data type. beta (Tensor): The beta β distribution parameter. It should be greater than 0. With float32 data type.
seed (int): Seed is used as entropy source for Random number engines generating pseudo-random numbers. seed (int): Seed is used as entropy source for Random number engines generating pseudo-random numbers.
Must be non-negative. Default: 0. Must be non-negative. Default: 0.
@ -164,7 +165,7 @@ def poisson(shape, mean, seed=0):
Args: Args:
shape (tuple): The shape of random tensor to be generated. shape (tuple): The shape of random tensor to be generated.
mean (Tensor): The mean μ distribution parameter. With float32 data type. mean (Tensor): The mean μ distribution parameter. It should be greater than 0. With float32 data type.
seed (int): Seed is used as entropy source for Random number engines generating pseudo-random numbers. seed (int): Seed is used as entropy source for Random number engines generating pseudo-random numbers.
Must be non-negative. Default: 0. Must be non-negative. Default: 0.

View File

@ -130,9 +130,9 @@ class Gamma(PrimitiveWithInfer):
Inputs: Inputs:
- **shape** (tuple) - The shape of random tensor to be generated. Only constant value is allowed. - **shape** (tuple) - The shape of random tensor to be generated. Only constant value is allowed.
- **alpha** (Tensor) - The α distribution parameter. - **alpha** (Tensor) - The α distribution parameter. It should be greater than 0.
It is also known as the shape parameter with float32 data type. It is also known as the shape parameter with float32 data type.
- **beta** (Tensor) - The β distribution parameter. - **beta** (Tensor) - The β distribution parameter. It should be greater than 0.
It is also known as the scale parameter with float32 data type. It is also known as the scale parameter with float32 data type.
Outputs: Outputs:
@ -185,8 +185,8 @@ class Poisson(PrimitiveWithInfer):
Inputs: Inputs:
- **shape** (tuple) - The shape of random tensor to be generated. Only constant value is allowed. - **shape** (tuple) - The shape of random tensor to be generated. Only constant value is allowed.
- **mean** (Tensor) - μ, parameter which the distribution was constructed with. - **mean** (Tensor) - μ parameter the distribution was constructed with. The parameter defines mean number
The parameter defines the mean number of occurrences of the event, with float32 data type. of occurrences of the event. It should be greater than 0. With float32 data type.
Outputs: Outputs:
Tensor. Its shape should be the broadcasted shape of `shape` and the shape of `mean`. Tensor. Its shape should be the broadcasted shape of `shape` and the shape of `mean`.