Fix the api of privateuse1 in comment (#106537)
Fix the api of privateuse1 in comment
Pull Request resolved: https://github.com/pytorch/pytorch/pull/106537
Approved by: https://github.com/albanD
diff --git a/torch/utils/backend_registration.py b/torch/utils/backend_registration.py
index 0536b73..fd1155a 100644
--- a/torch/utils/backend_registration.py
+++ b/torch/utils/backend_registration.py
@@ -21,7 +21,7 @@
(1) (In C++) implement kernels for various torch operations, and register them
to the PrivateUse1 dispatch key.
- (2) (In python) call torch.register_privateuse1_backend("foo")
+ (2) (In python) call torch.utils.rename_privateuse1_backend("foo")
You can now use "foo" as an ordinary device string in python.
@@ -80,7 +80,7 @@
Example::
>>> # xdoctest: +SKIP("failing")
- >>> torch.register_privateuse1_backend("foo")
+ >>> torch.utils.rename_privateuse1_backend("foo")
# This will work, assuming that you've implemented the right C++ kernels
# to implement torch.ones.
>>> a = torch.ones(2, device="foo")
@@ -285,8 +285,8 @@
Example::
>>> # xdoctest: +SKIP("failing")
- >>> torch.utils.register_privateuse1_backend("foo")
- >>> torch.utils.generate_for_privateuse1_backend()
+ >>> torch.utils.rename_privateuse1_backend("foo")
+ >>> torch.utils.generate_methods_for_privateuse1_backend()
# Then automatically generate backend-related attributes and methods.
>>> a = torch.tensor(2).foo()
>>> a.is_foo