2020 Lesson 6 / 06_multicat: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

@jeremy I ran into this error on Lesson 6 on Google Colab when executing:

I managed to fix this by adding ‘learn.model.cuda()’ before invoking the model.



Thanks @aparatgraf, I faced the same issue while running course-v4 and fastbook version of 06_multicat on colab, and adding the same line fixed it for me as well.

Thanks for the confirmation @vtecftwy

Hey there!

I ran into the same issue and this solution also worked for me. Although, before arriving here I found out that this error was related to the fact there were some memory allocations into the CPU and other variables allocated within the GPU, therefore producing this crash.

From a not-so-savvy guess on my side, what the command .cuda() does is migrating the cpu allocated variables to the GPU, properly transforming them.

Just leaving this comment as a further development on why one would get this error.