mirror of
https://github.com/ROCm/jax.git
synced 2025-04-24 06:36:05 +00:00

1. factor out rbg_prng_impl and unsafe_rbg_prng_impl. the former uses threefry2x32 for split and fold_in, while the latter uses untested heuristics based on calling rng_bit_generator itself as a kind of hash function 2. for unsafe_rbg_prng_impl's split and fold_in, generate longer sequences from rng_bit_generator (10x iterations) which may be useful on some backends 3. for unsafe_rbg_prng_impl, actually apply rng_bit_generator as our 'hash function' in fold_in Co-authored-by: Roy Frostig <frostig@google.com> Co-authored-by: Anselm Levskaya <levskaya@google.com>
26 lines
884 B
Python
26 lines
884 B
Python
# Copyright 2021 Google LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# flake8: noqa: F401
|
|
|
|
from jax._src.prng import (
|
|
PRNGImpl as PRNGImpl,
|
|
seed_with_impl as seed_with_impl,
|
|
threefry2x32_p as threefry2x32_p,
|
|
threefry_2x32 as threefry_2x32,
|
|
threefry_prng_impl as threefry_prng_impl,
|
|
rbg_prng_impl as rbg_prng_impl,
|
|
unsafe_rbg_prng_impl as unsafe_rbg_prng_impl,
|
|
)
|