A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.jax.dev/en/latest/_autosummary/jax.random.categorical.html below:

jax.random.categorical — JAX documentation

jax.random.categorical#
jax.random.categorical(key, logits, axis=-1, shape=None, replace=True)[source]#

Sample random values from categorical distributions.

Sampling with replacement uses the Gumbel max trick. Sampling without replacement uses the Gumbel top-k trick. See [1] for reference.

Parameters:
  • key (ArrayLike) – a PRNG key used as the random key.

  • logits (RealArray) – Unnormalized log probabilities of the categorical distribution(s) to sample from, so that softmax(logits, axis) gives the corresponding probabilities.

  • axis (int) – Axis along which logits belong to the same categorical distribution.

  • shape (Shape | None | None) – Optional, a tuple of nonnegative integers representing the result shape. Must be broadcast-compatible with np.delete(logits.shape, axis). The default (None) produces a result shape equal to np.delete(logits.shape, axis).

  • replace (bool) – If True (default), perform sampling with replacement. If False, perform sampling without replacement.

Returns:

A random array with int dtype and shape given by shape if shape is not None, or else np.delete(logits.shape, axis).

Return type:

Array

References


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3