@@ -124,7 +124,7 @@ def __init__(self, env=None):
124
124
super (ProcessFrame84 , self ).__init__ (env )
125
125
self .observation_space = spaces .Box (low = 0 , high = 255 , shape = (84 , 84 , 1 ))
126
126
127
- def _observation (self , obs ):
127
+ def observation (self , obs ):
128
128
return ProcessFrame84 .process (obs )
129
129
130
130
@staticmethod
@@ -150,12 +150,12 @@ def __init__(self, env):
150
150
old_shape = self .observation_space .shape
151
151
self .observation_space = gym .spaces .Box (low = 0.0 , high = 1.0 , shape = (old_shape [- 1 ], old_shape [0 ], old_shape [1 ]))
152
152
153
- def _observation (self , observation ):
153
+ def observation (self , observation ):
154
154
return np .swapaxes (observation , 2 , 0 )
155
155
156
156
157
157
class ClippedRewardsWrapper (gym .RewardWrapper ):
158
- def _reward (self , reward ):
158
+ def reward (self , reward ):
159
159
"""Change all the positive rewards to 1, negative to -1 and keep zero."""
160
160
return np .sign (reward )
161
161
@@ -190,13 +190,13 @@ def __init__(self, env, k):
190
190
shp = env .observation_space .shape
191
191
self .observation_space = spaces .Box (low = 0 , high = 255 , shape = (shp [0 ]* k , shp [1 ], shp [2 ]))
192
192
193
- def _reset (self ):
193
+ def reset (self ):
194
194
ob = self .env .reset ()
195
195
for _ in range (self .k ):
196
196
self .frames .append (ob )
197
197
return self ._get_ob ()
198
198
199
- def _step (self , action ):
199
+ def step (self , action ):
200
200
ob , reward , done , info = self .env .step (action )
201
201
self .frames .append (ob )
202
202
return self ._get_ob (), reward , done , info
@@ -383,4 +383,4 @@ def wrap_():
383
383
env = FrameStack (env , 4 )
384
384
env = ClippedRewardsWrapper (env )
385
385
return env
386
- return wrap_
386
+ return wrap_
0 commit comments