Hello, I have figured out what mistakes I take!
I make mistakes in the init() of the model like this:
mp_model = ToyMpModel(devices_list).cuda(devices_list[0])
ddp_mp_model = DDP(mp_model, device_ids=[0], find_unused_parameters=True)

I used multi-GPU model, but when I created model, I gave the model only one GPU.
Thus self.is_multi_device_module = len({p.device for p in module.parameters()}) > 1 is False in the distributed.py file.
I changed the GPU in the forward function. Thus triggering the error.
The solution is:
I defined the GPU in the init() function of the model. And then I changed the call function to
mp_model = ToyMpModel(devices_list)
ddp_mp_model = DDP(mp_model, device_ids=[], output_device=[], find_unused_parameters=True)

I hope my mistakes could bring some warnings to the latercommers.
I feel sorry for the confusion caused to you.
This problem can be closed.