Fix the Test of duplicate registration on genarator (#106536)
The duplicate registration test case shown in the figure below has always failed.
https://github.com/pytorch/pytorch/blob/3d165dc3f3e1ba42c7512200b1b9c14d4556ec61/test/test_cpp_extensions_open_device_registration.py#L171-L173
https://github.com/pytorch/pytorch/blob/3d165dc3f3e1ba42c7512200b1b9c14d4556ec61/aten/src/ATen/core/GeneratorForPrivateuseone.h#L36-L37
Because there is a static variable in the ```self.module.register_generator()``` function, it will only be initialized once.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/106536
Approved by: https://github.com/albanD