How to solve the problem of `RuntimeError: all tensors must be on devices[0]`

For the target yes, is your input already on the gpu?