Deep-Reinforcement-Learning-Algorithms-with-PyTorch icon indicating copy to clipboard operation
Deep-Reinforcement-Learning-Algorithms-with-PyTorch copied to clipboard

RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #4 'mat1'

Open Jeffrey28 opened this issue 6 years ago • 9 comments
trafficstars

I run the Cart_Pole.py and got the error.

Jeffrey28 avatar Oct 25 '19 07:10 Jeffrey28

And if I choose “use_GPU" is True. It works well. However, when it ran with A3C, I got the error: Runtime Error: CUDA error (3): initialization error. So, do you have any suggestions for me?

Jeffrey28 avatar Oct 25 '19 07:10 Jeffrey28

yeah,i have the same problem, when i run python3 results/Cartpole.py

lml519 avatar Oct 28 '19 12:10 lml519

GPU doesn't work with A3C because A3C uses multiprocessing - try turning off the GPU to see if it works. For small games anyway it is faster to run it with the GPU turned off.

p-christ avatar Oct 28 '19 14:10 p-christ

@p-christ but when i turn off the gpu. it will display RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #4 'mat1'

lml519 avatar Oct 29 '19 11:10 lml519

yeah

@p-christ but when i turn off the gpu. it will display RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #4 'mat1'

yeah, the same problem.

Jeffrey28 avatar Oct 30 '19 08:10 Jeffrey28

Have you also set: config.use_GPU = False ?

p-christ avatar Oct 30 '19 12:10 p-christ

Have you also set: config.use_GPU = False ?

Yeah, I have set.

Jeffrey28 avatar Oct 30 '19 14:10 Jeffrey28

So got the RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #4 'mat1'

Jeffrey28 avatar Oct 30 '19 14:10 Jeffrey28

Have you solved this problem yet?I have the same problem when I run results/Cartpole with any agent.

ztz695183179 avatar Dec 04 '19 06:12 ztz695183179