Skip to content

Commit e5169eb

Browse files
committed
no more warnings other than using cartpole v0
1 parent 37dd008 commit e5169eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

intermediate_source/reinforcement_q_learning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
import torchvision.transforms as T
7575

7676

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
7878

7979
# set up matplotlib
8080
is_ipython = 'inline' in matplotlib.get_backend()
@@ -254,7 +254,7 @@ def get_cart_location(screen_width):
254254
def get_screen():
255255
# Returned screen requested by gym is 400x600x3, but is sometimes larger
256256
# 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))
258258
# Cart is in the lower half, so strip off the top and bottom of the screen
259259
_, screen_height, screen_width = screen.shape
260260
screen = screen[:, int(screen_height*0.4):int(screen_height * 0.8)]

0 commit comments

Comments
 (0)