torch.utils.backend_registration.rename_privateuse1_backend
- torch.utils.backend_registration.rename_privateuse1_backend(backend_name)
Rename the privateuse1 backend device to make it more convenient to use as a device name within PyTorch APIs.
The steps are:
(In C++) implement kernels for various torch operations, and register them to the PrivateUse1 dispatch key.
(In python) call torch.utils.rename_privateuse1_backend(“foo”)
You can now use “foo” as an ordinary device string in python.
Note: this API can only be called once per process. Attempting to change the external backend after it’s already been set will result in an error.
Note(AMP): If you want to support AMP on your device, you can register a custom backend module. The backend must register a custom backend module with
. BackendModule needs to have the following API’s: