print(f"at device: {at.device}") print(f"j device: {j.device}") at = at.to(j.device) a = at[j] 来源于RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)_一颗小树x的博客-CSDN博客