rldurham.seed_everything
- rldurham.seed_everything(seed=None, env=None, seed_env=True, seed_actions=True, other=(), workers=False)[source]
This uses the PyTorch Lightning
seed_everything
method to seed pseudo-random number generators in pytorch, numpy, and python.random. Ifenv
is provided, it optionally resets the environment and seeds its action space with the same seed.- Parameters:
seed (
Optional
[int
]) – integer value, seeseed_everything
documentation for detailsenv (
Optional
[Env
]) –gymnasium
environmentseed_env (
bool
) – whether to reset/seedenv
(this is done by callingreset(seed=seed)
)seed_actions (
bool
) – whether to seed the action space ofenv
other (
Iterable
) – other objectsx
to callx.seed(seed)
onworkers (
bool
) – passed on toseed_everything
- Return type:
Union
[int
,tuple
]- Returns:
(seed, observation, info)
ifenv
was reset, otherwise, justseed