@@ -14,9 +14,9 @@ class EchoEnv(AbstractEnv[Float[Array, " n"], Float[Array, " n"]]):
1414 Echoes the action back as the observation, never terminates.
1515 """
1616
17- state_index : eqx .nn .StateIndex [None ]
1817 action_space : Box
1918 observation_space : Box
19+ state_index : eqx .nn .StateIndex [None ] = eqx .nn .StateIndex (None )
2020
2121 def __init__ (
2222 self ,
@@ -25,7 +25,6 @@ def __init__(
2525 ):
2626 self .action_space = action_space
2727 self .observation_space = observation_space
28- self .state_index = eqx .nn .StateIndex (None )
2928
3029 def reset (self , state , * , key ):
3130 return state , self .observation_space .sample (key ), {}
@@ -92,10 +91,9 @@ class PassThroughEnv(AbstractEnv[Float[Array, ""], Float[Array, ""]]):
9291 always returns observation = 0.0.
9392 """
9493
95- state_index : eqx .nn .StateIndex [None ]
94+ state_index : eqx .nn .StateIndex [None ] = eqx . nn . StateIndex ( None )
9695
97- def __init__ (self ):
98- self .state_index = eqx .nn .StateIndex (None )
96+ def __init__ (self ): ... # Override dataclass init to avoid unused argument warning
9997
10098 def reset (self , state , * , key ):
10199 return state , jnp .asarray (0.0 ), {}
@@ -171,12 +169,11 @@ class DiscreteActionEnv(AbstractEnv[Int[Array, ""], Float[Array, " n"]]):
171169 Never terminates/truncates.
172170 """
173171
174- state_index : eqx .nn .StateIndex [None ]
172+ state_index : eqx .nn .StateIndex [None ] = eqx . nn . StateIndex ( None )
175173 observation_space : Box
176174 action_space : Discrete
177175
178176 def __init__ (self , * , key , n_actions : int = 4 , obs_size : int = 3 ):
179- self .state_index = eqx .nn .StateIndex (None )
180177 self .observation_space = Box (- jnp .inf , jnp .inf , shape = (obs_size ,))
181178 self .action_space = Discrete (n_actions )
182179
0 commit comments