p-christ / Deep-Reinforcement-Learning-Algorithms-with-PyTorch

PyTorch implementations of deep reinforcement learning algorithms and environments
MIT License
5.59k stars 1.19k forks source link

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

Open Jeffrey28 opened 4 years ago

Jeffrey28 commented 4 years ago

I run the Cart_Pole.py and got the error.

Jeffrey28 commented 4 years ago

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?

lml519 commented 4 years ago

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

p-christ commented 4 years ago

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.

lml519 commented 4 years ago

@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'

Jeffrey28 commented 4 years ago

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.

p-christ commented 4 years ago

Have you also set: config.use_GPU = False ?

Jeffrey28 commented 4 years ago

Have you also set: config.use_GPU = False ?

Yeah, I have set.

Jeffrey28 commented 4 years ago

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

ztz695183179 commented 4 years ago

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