Skip to content

Commit 37c72ee

Browse files
committed
update
1 parent 9f23f16 commit 37c72ee

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

advanced_source/python_backend_autoload.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,20 @@ How it works
5656
:alt: Autoloading implementation
5757
:align: center
5858

59-
This mechanism is implemented based on Python's `Entry point
59+
This mechanism is implemented based on Python's `Entry points
6060
<https://packaging.python.org/en/latest/specifications/entry-points/>`_
6161
mechanism. We discover and load all of the specific entry points
6262
in ``torch/__init__.py`` that are defined by out-of-tree extensions.
63+
This feature is enabled by default and can be disabled using
64+
``export TORCH_DEVICE_BACKEND_AUTOLOAD=0``.
6365
Its implementation is in `[RFC] Add support for device extension autoloading
64-
<https://github.com/pytorch/pytorch/pull/127074>`_
66+
<https://github.com/pytorch/pytorch/pull/127074>`_.
67+
68+
.. note::
69+
70+
If you get an error like this: "Failed to load the backend extension",
71+
this error has nothing to do with PyTorch, you should ask the extension
72+
maintainer for help.
6573

6674
How to apply this to out-of-tree extensions?
6775
--------------------------------------------
@@ -91,6 +99,13 @@ package.
9199
92100
Now the ``torch_foo`` module can be imported when running import torch.
93101

102+
.. code-block:: python
103+
104+
>>> import torch
105+
No need to import torch_foo anymore! You can run torch.foo.is_available() directly.
106+
>>> torch.foo.is_available()
107+
True
108+
94109
Conclusion
95110
----------
96111

0 commit comments

Comments
 (0)