mlx.core.random.permutation

目录

mlx.core.random.permutation#

permutation(x: int | array, axis: int = 0, key: array | None = None, stream: None | Stream | Device = None) array#

Generate a random permutation or permute the entries of an array.

参数:
  • x (int or array, optional) -- If an integer is provided a random permtuation of mx.arange(x) is returned. Otherwise the entries of x along the given axis are randomly permuted.

  • axis (int, optional) -- The axis to permute along. Default: 0.

  • key (array, optional) -- A PRNG key. Default: None.

返回:

The generated random permutation or randomly permuted input array.

返回类型:

array