Join the newly launched
Discord community for real-time discussions, peer support, and direct interaction with the Meridian team!
meridian.backend.RNGHandler
Stay organized with collections
Save and categorize content based on your preferences.
TensorFlow implementation.
meridian.backend.RNGHandler(
seed: SeedType, *, _sanitized_seed: Optional[Any] = None
)
stateful tf.random.Generator
-based implementation.
Args |
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.
|
Raises |
ValueError
|
If seed is a sequence with a length other than 2.
|
Methods
advance_handler
View source
advance_handler() -> '_TFLegacyRNGHandler'
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
get_kernel_seed() -> Any
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
get_next_seed() -> Any
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-23 UTC.
[null,null,["Last updated 2025-09-23 UTC."],[],[],null,[]]