ray.rllib.models.distributions.Distribution.sample#

abstract Distribution.sample(*, sample_shape: Tuple[int, ...] = None, return_logp: bool = False, **kwargs) numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor | Tuple[numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor, numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor][source]#

Draw a sample from the distribution.

Parameters:
  • sample_shape – The shape of the sample to draw.

  • return_logp – Whether to return the logp of the sampled values.

  • **kwargs – Forward compatibility placeholder.

Returns:

The sampled values. If return_logp is True, returns a tuple of the sampled values and its logp.