Skip to content Skip to sidebar Skip to footer

Index 1 Is Out Of Bounds For Dimension 0 With Size 1

I am starting to learn about DQN, and I am trying to solve the FrozenLake-v0 problem from scratch by my self and using Pytorch so I will put the whole code since it's connected. cl

Solution 1:

since you are calling a tensor that contains a matrix, you need to specify which indices your calling in your case just adding [0] to the forward statement will solve the problem and in the [actions], replace it with [actions.item()]

self.Q.forward(states)[0][actions.item()] 

Post a Comment for "Index 1 Is Out Of Bounds For Dimension 0 With Size 1"