From a7b14b80913485735a3ee87da6998a511a1f1950 Mon Sep 17 00:00:00 2001 From: Morvan Zhou Date: Fri, 27 Oct 2017 09:06:10 +1100 Subject: [PATCH] fix action shape --- tutorial-contents/405_DQN_Reinforcement_learning.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorial-contents/405_DQN_Reinforcement_learning.py b/tutorial-contents/405_DQN_Reinforcement_learning.py index e40e87a..20fa80c 100644 --- a/tutorial-contents/405_DQN_Reinforcement_learning.py +++ b/tutorial-contents/405_DQN_Reinforcement_learning.py @@ -58,7 +58,7 @@ class DQN(object): # input only one sample if np.random.uniform() < EPSILON: # greedy actions_value = self.eval_net.forward(x) - action = torch.max(actions_value, 1)[1].data.numpy()[0] # return the argmax + action = torch.max(actions_value, 1)[1].data.numpy()[0, 0] # return the argmax else: # random action = np.random.randint(0, N_ACTIONS) return action