Backward pass error in GPU

When I do not have .cuda activated, I do not get any error when I call

 out.backward(torch.ones(output.size()))

But when i state that the model is in cuda, then this throws an error stating invalid combination of arguments.

model.cuda()
......
......
out.backward(torch.ones(output.size())

How do I fix this issue?

The error message probably says the method expected torch.cuda.FloatTensor, but found torch.FloatTensor?
Try to call out.backward(torch.ones(output.size()).cuda()).