forked from mindspore-Ecosystem/mindspore
parent
f24026f613
commit
d51483f235
|
@ -39,7 +39,7 @@ mindspore.nn.probability.bijector.GumbelCDF
|
|||
>>>
|
||||
>>> # 初始化GumbelCDF Bijector,loc设置为1.0和scale设置为2.0。
|
||||
>>> gumbel_cdf = msb.GumbelCDF(1.0, 2.0)
|
||||
>>> # 在网络中使用ScalarAffinebijector。
|
||||
>>> # 在网络中使用GumbelCDF bijector。
|
||||
>>> x = Tensor([1, 2, 3], dtype=mindspore.float32)
|
||||
>>> y = Tensor([0.1, 0.2, 0.3], dtype=mindspore.float32)
|
||||
>>> ans1 = gumbel_cdf.forward(x)
|
||||
|
|
|
@ -3,7 +3,7 @@ mindspore.nn.probability.bijector.PowerTransform
|
|||
|
||||
.. py:class:: mindspore.nn.probability.bijector.PowerTransform(power=0., name='PowerTransform')
|
||||
|
||||
乘方Bijector(Power Bijector)。
|
||||
乘方Bijector(PowerTransform Bijector)。
|
||||
此Bijector对应的映射函数为:
|
||||
|
||||
.. math::
|
||||
|
@ -11,7 +11,7 @@ mindspore.nn.probability.bijector.PowerTransform
|
|||
|
||||
其中幂c >= 0。
|
||||
|
||||
Power Bijector将输入从 `[-1/c, inf]` 映射到 `[0, inf]` 。
|
||||
PowerTransform Bijector将输入从 `[-1/c, inf]` 映射到 `[0, inf]` 。
|
||||
|
||||
当 `c=0` 时,此Bijector等于 :class:`mindspore.nn.probability.bijector.Exp` Bijector。
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ mindspore.nn.probability.distribution.Gumbel
|
|||
|
||||
- **loc** (int, float, list, numpy.ndarray, Tensor) - Gumbel分布的位置。
|
||||
- **scale** (int, float, list, numpy.ndarray, Tensor) - Gumbel分布的尺度。
|
||||
- **seed** (int) - 采样时使用的种子。如果为None,则使用全局种子。默认值:None。
|
||||
- **seed** (int) - 采样时使用的种子。如果为None,则使用全局种子。默认值:0。
|
||||
- **dtype** (mindspore.dtype) - 分布类型。默认值:mindspore.float32。
|
||||
- **name** (str) - 分布的名称。默认值:'Gumbel'。
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ mindspore.nn.probability.distribution.LogNormal
|
|||
|
||||
- **loc** (int, float, list, numpy.ndarray, Tensor) - 基础正态分布的平均值。默认值:None。
|
||||
- **scale** (int, float, list, numpy.ndarray, Tensor) - 基础正态分布的标准差。默认值:None。
|
||||
- **seed** (int) - 采样时使用的种子。如果为None,则使用全局种子。默认值:None。
|
||||
- **seed** (int) - 采样时使用的种子。如果为None,则使用全局种子。默认值:0。
|
||||
- **dtype** (mindspore.dtype) - 分布类型。默认值:mindspore.float32。
|
||||
- **name** (str) - 分布的名称。默认值:'LogNormal'。
|
||||
|
||||
|
|
|
@ -316,8 +316,8 @@ class Bijector(Cell):
|
|||
|
||||
Args:
|
||||
name (str): The name of the function.
|
||||
*args (list): A list of positional arguments that the function needs.
|
||||
**kwargs (dict): A dictionary of keyword arguments that the function needs.
|
||||
*args (list): the list of positional arguments forwarded to subclasses.
|
||||
**kwargs (dict): the dictionary of keyword arguments forwarded to subclasses.
|
||||
"""
|
||||
if name == 'forward':
|
||||
return self.forward(*args, **kwargs)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ============================================================================
|
||||
"""Power Bijector"""
|
||||
"""Exp Bijector"""
|
||||
from .power_transform import PowerTransform
|
||||
|
||||
|
||||
|
@ -28,15 +28,15 @@ class Exp(PowerTransform):
|
|||
name (str): The name of the Bijector. Default: 'Exp'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible apis of the Exp bijector are defined in the base class, including:
|
||||
|
||||
- **forward**
|
||||
- **inverse**
|
||||
- **forward_log_jacobian**
|
||||
- **backward_log_jacobian**
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
It should be notice that the inputs to the APIs of the Exp bijector should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs of the APIs of the Exp bijector,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Bijector`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
|
|
|
@ -33,16 +33,16 @@ class GumbelCDF(Bijector):
|
|||
name (str): The name of the Bijector. Default: 'GumbelCDF'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Gumbel_cdf bijector are defined in the base class, including:
|
||||
|
||||
- **forward**
|
||||
- **inverse**
|
||||
- **forward_log_jacobian**
|
||||
- **backward_log_jacobian**
|
||||
|
||||
It should be notice that the input should be always a tensor,
|
||||
It should be notice that the inputs of APIs of the Gumbel_cdf bijector should be always a tensor,
|
||||
with a shape that can be broadcasted to that of `loc` and `scale`.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
For more details of all APIs, including the inputs and outputs of APIs of the Gumbel_cdf bijector,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Bijector`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
|
@ -67,7 +67,7 @@ class GumbelCDF(Bijector):
|
|||
>>>
|
||||
>>> # To initialize a GumbelCDF bijector of loc 1.0, and scale 2.0.
|
||||
>>> gumbel_cdf = msb.GumbelCDF(1.0, 2.0)
|
||||
>>> # To use a ScalarAffine bijector in a network.
|
||||
>>> # To use a GumbelCDF bijector in a network.
|
||||
>>> x = Tensor([1, 2, 3], dtype=mindspore.float32)
|
||||
>>> y = Tensor([0.1, 0.2, 0.3], dtype=mindspore.float32)
|
||||
>>> ans1 = gumbel_cdf.forward(x)
|
||||
|
|
|
@ -26,18 +26,6 @@ class Invert(Bijector):
|
|||
name (str): The name of the Bijector. Default: "". When name is set to "", it is actually
|
||||
'Invert' + bijector.name.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
|
||||
- **forward**
|
||||
- **inverse**
|
||||
- **forward_log_jacobian**
|
||||
- **backward_log_jacobian**
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Bijector`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ============================================================================
|
||||
"""Power Bijector"""
|
||||
"""PowerTransform Bijector"""
|
||||
from mindspore.ops import operations as P
|
||||
from ..distribution._utils.utils import check_greater_equal_zero
|
||||
from ..distribution._utils.custom_ops import exp_generic, log_generic
|
||||
|
@ -21,7 +21,7 @@ from .bijector import Bijector
|
|||
|
||||
class PowerTransform(Bijector):
|
||||
r"""
|
||||
Power Bijector.
|
||||
PowerTransform Bijector.
|
||||
This Bijector performs the operation:
|
||||
|
||||
.. math::
|
||||
|
@ -38,16 +38,16 @@ class PowerTransform(Bijector):
|
|||
name (str): The name of the bijector. Default: 'PowerTransform'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the PowerTransform bijector are defined in the base class, including:
|
||||
|
||||
- **forward**
|
||||
- **inverse**
|
||||
- **forward_log_jacobian**
|
||||
- **backward_log_jacobian**
|
||||
|
||||
It should be notice that the input should be always a tensor,
|
||||
It should be notice that the inputs to APIs of the PowerTransform bijector should be always a tensor,
|
||||
with a shape that can be broadcasted to that of `power`.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
For more details of all APIs, including the inputs and outputs of the PowerTransform bijector,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Bijector`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
|
|
|
@ -34,16 +34,16 @@ class ScalarAffine(Bijector):
|
|||
name (str): The name of the bijector. Default: 'ScalarAffine'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Scalar affine bijector is defined in the base class, including:
|
||||
|
||||
- **forward**
|
||||
- **inverse**
|
||||
- **forward_log_jacobian**
|
||||
- **backward_log_jacobian**
|
||||
|
||||
It should be notice that the input should be always a tensor,
|
||||
It should be notice that the inputs to APIs of the Scalar affine bijector should be always a tensor,
|
||||
with a shape that can be broadcasted to that of `shift` and `scale`.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
For more details of all APIs, including the inputs and outputs of APIs of the scalar affine bijector,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Bijector`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
|
|
|
@ -35,16 +35,16 @@ class Softplus(Bijector):
|
|||
name (str): The name of the Bijector. Default: 'Softplus'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Softplus bijector is defined in the base class, including:
|
||||
|
||||
- **forward**
|
||||
- **inverse**
|
||||
- **forward_log_jacobian**
|
||||
- **backward_log_jacobian**
|
||||
|
||||
It should be notice that the input should be always a tensor,
|
||||
It should be notice that the inputs of APIs of APIs of the Softplus bijector should be always a tensor,
|
||||
with a shape that can be broadcasted to that of `sharpness`.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
For more details of all APIs, including the inputs and outputs of APIs of the Softplus bijector,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Bijector`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
|
|
|
@ -35,16 +35,15 @@ class Bernoulli(Distribution):
|
|||
name (str): The name of the distribution. Default: 'Bernoulli'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of Bernoulli distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of the APIs of the Bernoulli distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
@ -55,7 +54,6 @@ class Bernoulli(Distribution):
|
|||
|
||||
Raises:
|
||||
ValueError: When p <= 0 or p >=1.
|
||||
TypeError: When the input `dtype` is not a subclass of float.
|
||||
|
||||
Examples:
|
||||
>>> import mindspore
|
||||
|
|
|
@ -44,16 +44,15 @@ class Beta(Distribution):
|
|||
name (str): The name of the distribution. Default: 'Beta'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Beta distribution are defined in the base class, including:
|
||||
|
||||
- `prob` and `log_prob`
|
||||
- `mean`, `sd`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of APIs of the Beta distribution
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend``
|
||||
|
|
|
@ -40,16 +40,15 @@ class Categorical(Distribution):
|
|||
name (str): The name of the distribution. Default: Categorical.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Categorical distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of the APIs of the Categorical distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
|
|
@ -42,16 +42,15 @@ class Cauchy(Distribution):
|
|||
name (str): The name of the distribution. Default: 'Cauchy'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Cauchy distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mode` and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of the APIs of the Cauchy distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend``
|
||||
|
|
|
@ -78,7 +78,7 @@ class Distribution(Cell):
|
|||
# if not a transformed distribution, set the following attribute
|
||||
if 'distribution' not in self.parameters.keys():
|
||||
self.parameter_type = set_param_type(
|
||||
self.parameters['param_dict'], dtype)
|
||||
self.parameters.get('param_dict', {}), dtype)
|
||||
self._batch_shape = self._calc_batch_shape()
|
||||
self._is_scalar_batch = self._check_is_scalar_batch()
|
||||
self._broadcast_shape = self._batch_shape
|
||||
|
@ -397,7 +397,7 @@ class Distribution(Cell):
|
|||
**kwargs (dict): the dictionary of keyword arguments forwarded to subclasses.
|
||||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its dist_spec_args through
|
||||
A distribution can be optionally passed to the function by passing its `dist_spec_args` through
|
||||
`args` or `kwargs`.
|
||||
"""
|
||||
return self._call_log_prob(value, *args, **kwargs)
|
||||
|
@ -421,7 +421,7 @@ class Distribution(Cell):
|
|||
**kwargs (dict): the dictionary of keyword arguments forwarded to subclasses.
|
||||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its dist_spec_args through
|
||||
A distribution can be optionally passed to the function by passing its `dist_spec_args` through
|
||||
`args` or `kwargs`.
|
||||
"""
|
||||
return self._call_prob(value, *args, **kwargs)
|
||||
|
@ -445,7 +445,7 @@ class Distribution(Cell):
|
|||
**kwargs (dict): the dictionary of keyword arguments forwarded to subclasses.
|
||||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its dist_spec_args through
|
||||
A distribution can be optionally passed to the function by passing its `dist_spec_args` through
|
||||
`args` or `kwargs`.
|
||||
|
||||
Output:
|
||||
|
@ -490,7 +490,7 @@ class Distribution(Cell):
|
|||
**kwargs (dict: the dictionary of keyword arguments forwarded to subclasses.
|
||||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its dist_spec_args through
|
||||
A distribution can be optionally passed to the function by passing its `dist_spec_args` through
|
||||
`args` or `kwargs`.
|
||||
|
||||
Output:
|
||||
|
@ -517,7 +517,7 @@ class Distribution(Cell):
|
|||
**kwargs (dict): the dictionary of keyword arguments forwarded to subclasses.
|
||||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its dist_spec_args through
|
||||
A distribution can be optionally passed to the function by passing its `dist_spec_args` through
|
||||
`args` or `kwargs`.
|
||||
|
||||
Output:
|
||||
|
@ -553,7 +553,7 @@ class Distribution(Cell):
|
|||
**kwargs (dict): the dictionary of keyword arguments forwarded to subclasses.
|
||||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its dist_spec_args through
|
||||
A distribution can be optionally passed to the function by passing its `dist_spec_args` through
|
||||
`args` or `kwargs`.
|
||||
|
||||
Output:
|
||||
|
@ -583,8 +583,8 @@ class Distribution(Cell):
|
|||
**kwargs (dict): the dictionary of keyword arguments forwarded to subclasses.
|
||||
|
||||
Note:
|
||||
dist_spec_args of distribution b must be passed to the function through `args` or `kwargs`.
|
||||
Passing in dist_spec_args of distribution a is optional.
|
||||
`dist_spec_args` of distribution b must be passed to the function through `args` or `kwargs`.
|
||||
Passing in `dist_spec_args` of distribution a is optional.
|
||||
|
||||
Output:
|
||||
Tensor, the kl loss function of the distribution.
|
||||
|
@ -604,7 +604,7 @@ class Distribution(Cell):
|
|||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its *dist_spec_args* through
|
||||
*args* or *kwargs*.
|
||||
`args` or `kwargs`.
|
||||
|
||||
Output:
|
||||
Tensor, the mean of the distribution.
|
||||
|
@ -624,7 +624,7 @@ class Distribution(Cell):
|
|||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its *dist_spec_args* through
|
||||
*args* or *kwargs*.
|
||||
`args` or `kwargs`.
|
||||
|
||||
Output:
|
||||
Tensor, the mode of the distribution.
|
||||
|
@ -641,7 +641,7 @@ class Distribution(Cell):
|
|||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its *dist_spec_args* through
|
||||
*args* or *kwargs*.
|
||||
`args` or `kwargs`.
|
||||
|
||||
Output:
|
||||
Tensor, the standard deviation of the distribution.
|
||||
|
@ -658,7 +658,7 @@ class Distribution(Cell):
|
|||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its *dist_spec_args* through
|
||||
*args* or *kwargs*.
|
||||
`args` or `kwargs`.
|
||||
|
||||
Output:
|
||||
Tensor, the variance of the distribution.
|
||||
|
@ -696,7 +696,7 @@ class Distribution(Cell):
|
|||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its *dist_spec_args* through
|
||||
*args* or *kwargs*.
|
||||
`args` or `kwargs`.
|
||||
|
||||
Output:
|
||||
Tensor, the entropy of the distribution.
|
||||
|
@ -713,8 +713,8 @@ class Distribution(Cell):
|
|||
**kwargs (dict): the dictionary of keyword arguments forwarded to subclasses.
|
||||
|
||||
Note:
|
||||
dist_spec_args of distribution b must be passed to the function through `args` or `kwargs`.
|
||||
Passing in dist_spec_args of distribution a is optional.
|
||||
`dist_spec_args` of distribution b must be passed to the function through `args` or `kwargs`.
|
||||
Passing in `dist_spec_args` of distribution a is optional.
|
||||
|
||||
Output:
|
||||
Tensor, the cross_entropy of two distributions.
|
||||
|
@ -744,7 +744,7 @@ class Distribution(Cell):
|
|||
|
||||
Note:
|
||||
A distribution can be optionally passed to the function by passing its *dist_spec_args* through
|
||||
*args* or *kwargs*.
|
||||
`args` or `kwargs`.
|
||||
|
||||
Output:
|
||||
Tensor, the sample generated from the distribution.
|
||||
|
|
|
@ -41,16 +41,15 @@ class Exponential(Distribution):
|
|||
name (str): The name of the distribution. Default: 'Exponential'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Exp distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of all APIs of the Exp distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
|
|
@ -46,16 +46,15 @@ class Gamma(Distribution):
|
|||
name (str): The name of the distribution. Default: 'Gamma'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Gamma distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `mode`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of all APIs of the Gamma distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend``
|
||||
|
|
|
@ -32,22 +32,21 @@ class Geometric(Distribution):
|
|||
trials when the first success is achieved.
|
||||
|
||||
Args:
|
||||
probs (int, float, list, numpy.ndarray, Tensor): The probability of success. Default: None.
|
||||
probs (float, list, numpy.ndarray, Tensor): The probability of success. Default: None.
|
||||
seed (int): The seed used in sampling. Global seed is used if it is None. Default: None.
|
||||
dtype (mindspore.dtype): The type of the event samples. Default: mstype.int32.
|
||||
name (str): The name of the distribution. Default: 'Geometric'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Geometric distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `mode`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of all APIs of the Geometric distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
|
|
@ -39,18 +39,21 @@ class Gumbel(TransformedDistribution):
|
|||
Args:
|
||||
loc (int, float, list, numpy.ndarray, Tensor): The location of Gumbel distribution. Default: None.
|
||||
scale (int, float, list, numpy.ndarray, Tensor): The scale of Gumbel distribution. Default: None.
|
||||
seed (int): the seed used in sampling. The global seed is used if it is None. Default: None.
|
||||
seed (int): the seed used in sampling. The global seed is used if it is None. Default: 0.
|
||||
dtype (mindspore.dtype): type of the distribution. Default: mstype.float32.
|
||||
name (str): the name of the distribution. Default: 'Gumbel'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Gumbel distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `mode`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
For more details of all APIs, including the inputs and outputs of all APIs of the Gumbel distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
||||
|
@ -58,13 +61,13 @@ class Gumbel(TransformedDistribution):
|
|||
`scale` must be greater than zero.
|
||||
`dist_spec_args` are `loc` and `scale`.
|
||||
`dtype` must be a float type because Gumbel distributions are continuous.
|
||||
`kl_loss` and `cross_entropy` are not supported on GPU backend.
|
||||
|
||||
Raises:
|
||||
ValueError: When scale <= 0.
|
||||
TypeError: When the input `dtype` is not a subclass of float.
|
||||
|
||||
Examples:
|
||||
>>> import numpy as np
|
||||
>>> import mindspore
|
||||
>>> import mindspore.nn as nn
|
||||
>>> import mindspore.nn.probability.distribution as msd
|
||||
|
|
|
@ -40,22 +40,21 @@ class LogNormal(msd.TransformedDistribution):
|
|||
loc (int, float, list, numpy.ndarray, Tensor): The mean of the underlying Normal distribution. Default: None.
|
||||
scale (int, float, list, numpy.ndarray, Tensor): The standard deviation of the underlying
|
||||
Normal distribution. Default: None.
|
||||
seed (int): the seed used in sampling. The global seed is used if it is None. Default: None.
|
||||
seed (int): the seed used in sampling. The global seed is used if it is None. Default: 0.
|
||||
dtype (mindspore.dtype): type of the distribution. Default: mstype.float32.
|
||||
name (str): the name of the distribution. Default: 'LogNormal'.
|
||||
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Log-Normal distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `mode`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of APIs of the Log-Normal distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
|
|
@ -42,16 +42,15 @@ class Logistic(Distribution):
|
|||
name (str): The name of the distribution. Default: 'Logistic'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Logistic distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `mode`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of all APIs of the Logistic distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
|
|
@ -44,16 +44,15 @@ class Normal(Distribution):
|
|||
name (str): The name of the distribution. Default: 'Normal'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Normal distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `mode`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of all APIs of the Normal distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
|
|
@ -38,16 +38,15 @@ class Poisson(Distribution):
|
|||
name (str): The name of the distribution. Default: 'Poisson'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Poisson distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `mode`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of all APIs of the Poisson distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend``
|
||||
|
@ -58,7 +57,6 @@ class Poisson(Distribution):
|
|||
|
||||
Raises:
|
||||
ValueError: When rate <= 0.
|
||||
TypeError: When the input `dtype` is not a subclass of float.
|
||||
|
||||
Examples:
|
||||
>>> import mindspore
|
||||
|
|
|
@ -41,15 +41,14 @@ class TransformedDistribution(Distribution):
|
|||
name (str): The name of the transformed distribution. Default: 'transformed_distribution'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the transformed distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of all APIs of the transformed distribution,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
|
|
@ -42,16 +42,15 @@ class Uniform(Distribution):
|
|||
name (str): The name of the distribution. Default: 'Uniform'.
|
||||
|
||||
Inputs and Outputs of APIs:
|
||||
The accessible api is defined in the base class, including:
|
||||
The accessible APIs of the Uniform distribution are defined in the base class, including:
|
||||
|
||||
- `prob`, `log_prob`, `cdf`, `log_cdf`, `survival_function`, and `log_survival`
|
||||
- `mean`, `sd`, `var`, and `entropy`
|
||||
- `kl_loss` and `cross_entropy`
|
||||
- `sample`
|
||||
|
||||
It should be notice that the input should be always a tensor.
|
||||
For more details of all APIs, including the inputs and outputs,
|
||||
please refer to :class:`mindspore.nn.probability.bijector.Distribution`, and examples below.
|
||||
For more details of all APIs, including the inputs and outputs of all APIs of the Uniform distribution ,
|
||||
please refer to :class:`mindspore.nn.probability.distribution.Distribution`, and examples below.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
|
Loading…
Reference in New Issue