You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.nn.probability.distribution.Gumbel.rst 1.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. mindspore.nn.probability.distribution.Gumbel
  2. ================================================
  3. .. py:class:: mindspore.nn.probability.distribution.Gumbel(loc, scale, seed=0, dtype=mindspore.float32, name='Gumbel')
  4. 耿贝尔分布(Gumbel distribution)。
  5. **参数:**
  6. - **loc** (float, list, numpy.ndarray, Tensor) - 耿贝尔分布的位置。
  7. - **scale** (float, list, numpy.ndarray, Tensor) - 耿贝尔分布的尺度。
  8. - **seed** (int) - 采样时使用的种子。如果为None,则使用全局种子。默认值:None。
  9. - **dtype** (mindspore.dtype) - 分布类型。默认值:mindspore.float32。
  10. - **name** (str) - 分布的名称。默认值:'Gumbel'。
  11. **支持平台:**
  12. ``Ascend`` ``GPU``
  13. .. note::
  14. - `scale` 必须大于零。
  15. - `dtype` 必须是浮点类型,因为耿贝尔分布是连续的。
  16. - GPU后端不支持 `kl_loss` 和 `cross_entropy` 。
  17. **样例:**
  18. >>> import mindspore
  19. >>> import mindspore.nn as nn
  20. >>> import mindspore.nn.probability.distribution as msd
  21. >>> from mindspore import Tensor
  22. >>> class Prob(nn.Cell):
  23. ... def __init__(self):
  24. ... super(Prob, self).__init__()
  25. ... self.gum = msd.Gumbel(np.array([0.0]), np.array([[1.0], [2.0]]), dtype=mindspore.float32)
  26. ...
  27. ... def construct(self, x_):
  28. ... return self.gum.prob(x_)
  29. >>> value = np.array([1.0, 2.0]).astype(np.float32)
  30. >>> pdf = Prob()
  31. >>> output = pdf(Tensor(value, dtype=mindspore.float32))
  32. .. py:method:: loc
  33. :property:
  34. 返回分布位置。
  35. .. py:method:: scale
  36. :property:
  37. 返回分布尺度。