Skip to content

Commit e425fe9

Browse files
committed
update
1 parent ee5c353 commit e425fe9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

advanced_source/python_extension_autoload.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Autoloading Out-of-Tree Extension
2-
===========================================
2+
=================================
33

4-
**Author:** `Yuanhao Ji <www.github.com/shink>`__
4+
**Author:** `Yuanhao Ji <https://github.com/shink>`__
55

66
The extension autoloading mechanism enables PyTorch to automatically
77
load out-of-tree backend extensions without explicit import statements. This
8-
feature is beneficial for users as it enhances their
8+
feature is beneficial for users as it enhances their
99
experience and enables them to follow the familiar PyTorch device
1010
programming model without having to explicitly load or import device-specific
1111
extensions. Additionally, it facilitates effortless
@@ -25,6 +25,7 @@ out-of-tree devices. For further details, refer to the
2525
:class-card: card-prerequisites
2626

2727
* PyTorch v2.5 or later
28+
2829
.. note::
2930

3031
This feature is enabled by default and can be disabled by using
@@ -42,7 +43,7 @@ your package is compatible with PyTorch 2.5 or later and includes the following
4243
.. code-block:: python
4344
4445
def _autoload():
45-
print("No need to import torch_foo anymore! Check things are working with `torch.foo.is_available()`.")
46+
print("Check things are working with `torch.foo.is_available()`.")
4647
4748
Then, the only thing you need to do is define an entry point within your Python package:
4849

@@ -177,5 +178,7 @@ See the implementation in this pull request: `[RFC] Add support for device exten
177178
Conclusion
178179
----------
179180

180-
This tutorial has guided you through the out-of-tree extension autoloading
181-
mechanism, including its usage and implementation.
181+
In this tutorial, we learned about the out-of-tree extension autoloading mechanism in PyTorch, which automatically
182+
loads backend extensions eliminating the need to add additional import statements. We also learned how to apply
183+
this mechanism to out-of-tree extensions by defining an entry point and how to prevent circular imports.
184+
We also reviewed an example on how to use the autoloading mechanism with Intel Gaudi HPU and Huawei Ascend NPU.

0 commit comments

Comments
 (0)