Hi, thank you for your reply, I was actually able to find the solution to my problem. I was adding a floatTensor (cpu) to a cuda floatTensor (gpu) and this was causing errors. The error did not actually lie in this piece of code.