Hi, thanks for your friendly reply!
The problem is the error said it expected data from CPU, but I gave it from my GPU. You can see from my codes that my model, input image, and groundtruth labels are all in GPU by .cuda(), but w_pos is not. So I think it might be the problems from those 3 variables that are already in GPU?
I tried w_pos = torch.tensor([4.538]).cuda() before asking this question, but it showed the similar error. I think probably it was not related to w_pos? Any new ideas?
Thanks again for reply!