Skip to content

Commit f65e27f

Browse files
committed
update for torch 0.3
1 parent 5df56c9 commit f65e27f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tutorial-contents/405_DQN_Reinforcement_learning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
More about Reinforcement learning: https://morvanzhou.github.io/tutorials/machine-learning/reinforcement-learning/
55
66
Dependencies:
7-
torch: 0.2
7+
torch: 0.3
88
gym: 0.8.1
99
numpy
1010
"""
@@ -60,7 +60,7 @@ def choose_action(self, x):
6060
if np.random.uniform() < EPSILON: # greedy
6161
actions_value = self.eval_net.forward(x)
6262
action = torch.max(actions_value, 1)[1].data.numpy()
63-
action = action[0, 0] if ENV_A_SHAPE == 0 else action.reshape(ENV_A_SHAPE) # return the argmax index
63+
action = action[0] if ENV_A_SHAPE == 0 else action.reshape(ENV_A_SHAPE) # return the argmax index
6464
else: # random
6565
action = np.random.randint(0, N_ACTIONS)
6666
action = action if ENV_A_SHAPE == 0 else action.reshape(ENV_A_SHAPE)

0 commit comments

Comments
 (0)