meridian.backend.RNGHandler

TensorFlow implementation.

stateful tf.random.Generator-based implementation.

seed The initial seed. Can be an integer, a sequence of two integers, a corresponding Tensor, or None.
_sanitized_seed For internal use only. If provided, this pre-computed seed tensor is used directly, and the standard initialization logic for the public seed argument is bypassed.

ValueError If seed is a sequence with a length other than 2.

Methods

advance_handler

View source

Creates a new handler by incrementing the sanitized seed by 1.

Returns
A new _TFLegacyRNGHandler instance with an incremented seed state.

Raises
RuntimeError If the handler's sanitized seed was not initialized.

get_kernel_seed

View source

Provides a backend-appropriate sanitized seed/key for an MCMC kernel.

This method exposes the current state of the handler in the format expected by the backend's MCMC machinery. It does not advance the internal state.

Returns
A backend-specific seed object (e.g., a JAX PRNGKey or a TF Tensor).

get_next_seed

View source

Returns the original integer seed to preserve prior sampling behavior.

Returns
The original integer seed provided during initialization.

Raises
RuntimeError If the handler was not initialized with a scalar integer seed, which is required for the legacy prior sampling path.