Skip to content

Commit 42351df

Browse files
authored
Add a warning in docstring of state
Address the concern in JuliaReinforcementLearning/GridWorlds.jl#146 (comment)
1 parent ebd9519 commit 42351df

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ReinforcementLearningBase/src/interface.jl

+4
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ The state can be of any type. However, most neural network based algorithms
448448
assume an `AbstractArray` is returned. For environments with many different states
449449
provided (inner state, information state, etc), users need to provide `style`
450450
to declare which kind of state they want.
451+
452+
!!! warning
453+
The state **may** be reused and be mutated at each step. Always remember to make a copy
454+
if this is not what you expect.
451455
"""
452456
@multi_agent_env_api state(env::AbstractEnv) = state(env, DefaultStateStyle(env))
453457
state(env::AbstractEnv, ss::AbstractStateStyle) = state(env, ss, current_player(env))

0 commit comments

Comments
 (0)