Base Wrappers¶
The abstract base classes every wrapper inherits from. Inherit from these to create your own!
envrax.wrappers.base.Wrapper
¶
Bases: JaxEnv[ObsSpaceT, ActSpaceT, StateT, ConfigT]
Abstract base class for pass-through JaxEnv wrappers.
Pass-through wrappers preserve the inner env's state type unchanged. They declare four TypeVars:
| Text Only | |
|---|---|
1 | |
For wrappers that introduce their own outer state type wrapping the
inner state, use StatefulWrapper instead.
The observation_space and action_space properties delegate to the
inner environment by default and may be overridden when the wrapper
changes the observation shape or action set.
Parameterised wrappers support a factory mode: calling the class
without an env (using only keyword arguments) returns a
_WrapperFactory rather than a live wrapper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env
|
JaxEnv
|
Inner environment to wrap. |
required |
Source code in envrax/wrappers/base.py
| Python | |
|---|---|
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
unwrapped
property
¶
Return the innermost JaxEnv by delegating through the wrapper chain.
observation_space
property
¶
Observation space of the inner environment.
action_space
property
¶
Action space of the inner environment.
reset(rng)
abstractmethod
¶
Reset the environment and return the initial observation and state.
Source code in envrax/wrappers/base.py
| Python | |
|---|---|
96 97 98 99 | |
step(state, action)
abstractmethod
¶
Advance the environment by one step.
Source code in envrax/wrappers/base.py
| Python | |
|---|---|
101 102 103 104 105 106 107 108 | |
render(state, **kwargs)
¶
Forward render to the inner environment.
Source code in envrax/wrappers/base.py
| Python | |
|---|---|
115 116 117 | |
envrax.wrappers.base.StatefulWrapper
¶
Bases: Wrapper[ObsSpaceT, ActSpaceT, StateT, ConfigT], Generic[ObsSpaceT, ActSpaceT, StateT, ConfigT, InnerStateT]
Abstract base class for stateful JaxEnv wrappers.
Stateful wrappers introduce their own outer state type that wraps the
inner env's state. They declare five TypeVars — pinning StateT to
their wrapper-specific class and leaving InnerStateT parametric:
| Text Only | |
|---|---|
1 2 3 | |
For wrappers that preserve the inner state unchanged, use Wrapper
instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env
|
JaxEnv
|
Inner environment to wrap. |
required |
Source code in envrax/wrappers/base.py
| Python | |
|---|---|
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |