Thanks for your reply. In the above code,  outputs1, outputs2 and labels are on GPU3. The model are on GPU2. But I don’t know why it can’t work. The error imformation is “but input a is on cuda:1 and input b is on cuda:2”