1/ When you are creating a target of training samples, it must be a tensor.
2/ If you want to use cuda to compute, the data that input the net:forward/backward and criterion forward/backward must be cuda tensor. And net and criterion can use net:cuda() directly to become the net for cuda. However, data like tensor must be transformed by data = data:cuda(). Keep in mind.