File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 74
74
import torchvision .transforms as T
75
75
76
76
77
- env = gym .make ('CartPole-v0' , render_mode = 'single_rgb_array' ).unwrapped
77
+ env = gym .make ('CartPole-v0' , new_step_api = True , render_mode = 'single_rgb_array' ).unwrapped
78
78
79
79
# set up matplotlib
80
80
is_ipython = 'inline' in matplotlib .get_backend ()
@@ -254,7 +254,7 @@ def get_cart_location(screen_width):
254
254
def get_screen ():
255
255
# Returned screen requested by gym is 400x600x3, but is sometimes larger
256
256
# such as 800x1200x3. Transpose it into torch order (CHW).
257
- screen = env .render (mode = 'rgb_array' ).transpose ((2 , 0 , 1 ))
257
+ screen = env .render ().transpose ((2 , 0 , 1 ))
258
258
# Cart is in the lower half, so strip off the top and bottom of the screen
259
259
_ , screen_height , screen_width = screen .shape
260
260
screen = screen [:, int (screen_height * 0.4 ):int (screen_height * 0.8 )]
You can’t perform that action at this time.
0 commit comments