提交 707e849c authored 作者: Rémi Louf's avatar Rémi Louf 提交者: Brandon T. Willard

Add docstring for `PermutationRV`

上级 840d6f95
......@@ -1722,6 +1722,8 @@ choice = ChoiceRV()
class PermutationRV(RandomVariable):
"""Randomly shuffle a sequence."""
name = "permutation"
ndim_supp = 1
ndims_params = [1]
......@@ -1745,6 +1747,15 @@ class PermutationRV(RandomVariable):
return x_shape
def __call__(self, x, **kwargs):
r"""Randomly permute a sequence or a range of values.
Parameters
----------
x
If `x` is an integer, randomly permute `np.arange(x)`. If `x` is a sequence,
shuffle its elements randomly.
"""
x = as_tensor_variable(x)
return super().__call__(x, dtype=x.dtype, **kwargs)
......
......@@ -52,6 +52,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe
.. autoclass:: aesara.tensor.random.basic.ChoiceRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.PermutationRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.BernoulliRV
:members: __call__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论