mindspore.nn.probability.distribution.Gumbel

class mindspore.nn.probability.distribution.Gumbel(loc, scale, seed=0, dtype=mstype.float32, name='Gumbel')[source]

Gumbel distribution.

Parameters
  • loc (float, list, numpy.ndarray, Tensor) – The location of Gumbel distribution.

  • scale (float, list, numpy.ndarray, Tensor) – The scale of Gumbel distribution.

  • seed (int) – the seed used in sampling. The global seed is used if it is None. Default: None.

  • dtype (mindspore.dtype) – type of the distribution. Default: mstype.float32.

  • name (str) – the name of the distribution. Default: ‘Gumbel’.

Supported Platforms:

Ascend GPU

Note

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.

Examples

>>> import mindspore
>>> import mindspore.nn as nn
>>> import mindspore.nn.probability.distribution as msd
>>> from mindspore import Tensor
>>> class Prob(nn.Cell):
...     def __init__(self):
...         super(Prob, self).__init__()
...         self.gum = msd.Gumbel(np.array([0.0]), np.array([[1.0], [2.0]]), dtype=mindspore.float32)
...
...     def construct(self, x_):
...         return self.gum.prob(x_)
>>> value = np.array([1.0, 2.0]).astype(np.float32)
>>> pdf = Prob()
>>> output = pdf(Tensor(value, dtype=mindspore.float32))
extend_repr()[source]

Display instance object as string.

property loc

Return the location of the distribution after casting to dtype.

property scale

Return the scale of the distribution after casting to dtype.