From 54d38e4d13086cc6f2743727efc2524bc2492d02 Mon Sep 17 00:00:00 2001 From: peixu_ren Date: Mon, 14 Sep 2020 16:50:50 -0400 Subject: [PATCH] Restrict the range of the parameters in random ops --- mindspore/ops/composite/random_ops.py | 9 +++++---- mindspore/ops/operations/random_ops.py | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mindspore/ops/composite/random_ops.py b/mindspore/ops/composite/random_ops.py index aa97ec079f4..d104375e689 100644 --- a/mindspore/ops/composite/random_ops.py +++ b/mindspore/ops/composite/random_ops.py @@ -49,7 +49,8 @@ def normal(shape, mean, stddev, seed=0): shape (tuple): The shape of random tensor to be generated. mean (Tensor): The mean μ distribution parameter, which specifies the location of the peak. 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. Must be non-negative. Default: 0. @@ -136,8 +137,8 @@ def gamma(shape, alpha, beta, seed=0): Args: shape (tuple): The shape of random tensor to be generated. - alpha (Tensor): The alpha α distribution parameter. With float32 data type. - beta (Tensor): The beta β 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. 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. Must be non-negative. Default: 0. @@ -164,7 +165,7 @@ def poisson(shape, mean, seed=0): Args: 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. Must be non-negative. Default: 0. diff --git a/mindspore/ops/operations/random_ops.py b/mindspore/ops/operations/random_ops.py index b324ca56f3b..a35347f02a3 100644 --- a/mindspore/ops/operations/random_ops.py +++ b/mindspore/ops/operations/random_ops.py @@ -130,9 +130,9 @@ class Gamma(PrimitiveWithInfer): Inputs: - **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. - - **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. Outputs: @@ -185,8 +185,8 @@ class Poisson(PrimitiveWithInfer): Inputs: - **shape** (tuple) - The shape of random tensor to be generated. Only constant value is allowed. - - **mean** (Tensor) - μ, parameter which the distribution was constructed with. - The parameter defines the mean number of occurrences of the event, with float32 data type. + - **mean** (Tensor) - μ parameter the distribution was constructed with. The parameter defines mean number + of occurrences of the event. It should be greater than 0. With float32 data type. Outputs: Tensor. Its shape should be the broadcasted shape of `shape` and the shape of `mean`.