higgsfield / RL-Adventure

Pytorch Implementation of DQN / DDQN / Prioritized replay/ noisy networks/ distributional values/ Rainbow/ hierarchical RL
2.99k stars 587 forks source link

cuda tensor instead of int in 1.dqn #10

Closed garkavem closed 5 years ago

garkavem commented 6 years ago

Hi! Thanks for the great tutorials! I had an issue with class DQN(nn.Module), in method act this thing action = q_value.max(1)[1].data[0] seemed to return some torch cuda tensor, that env.step naturally couldn't take as input. I replaced it with with action = int(q_value.max(1)[1].data[0].cpu().int().numpy()) and it works for me.