Skip to content

Commit 3cdec7b

Browse files
authored
Restructure Python custom operators guide (#3916)
Split the custom Python operators tutorial into an overview plus focused pages for functional operators, mutable operators, and optional registrations. Emphasize required schema and mutation/aliasing contracts, opcheck validation, fake kernels for torch.compile/export, and 2.13-only in-place/out custom operator behavior. Add the new pages under the custom operators landing page so the left navigation exposes a nested custom-ops section and users can move through the guide in order. Validated with lintrunner -m main and make clean-cache && make html-noplot. This was generated by codex and I didn't read it carefully (but I did read most of it).
1 parent 708b21c commit 3cdec7b

8 files changed

Lines changed: 687 additions & 286 deletions

advanced_source/custom_ops_landing_page.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,21 @@ In order to do so, you must register the custom operation with PyTorch via the P
1010
`torch.library docs <https://pytorch.org/docs/stable/library.html>`_ or C++ ``TORCH_LIBRARY``
1111
APIs.
1212

13+
.. toctree::
14+
:maxdepth: 2
15+
:hidden:
16+
17+
python_custom_ops
18+
cpp_custom_ops
1319

1420

1521
Authoring a custom operator from Python
1622
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1723

18-
Please see :ref:`python-custom-ops-tutorial`.
24+
Please see :ref:`python-custom-ops-tutorial` for the Python guide. It covers
25+
the required schema and mutation/aliasing contract, ``opcheck``, functional
26+
operators, mutable operators, and optional registrations such as autograd and
27+
``torch.vmap``.
1928

2029
You may wish to author a custom operator from Python (as opposed to C++) if:
2130

@@ -43,8 +52,8 @@ The Custom Operators Manual
4352
^^^^^^^^^^^^^^^^^^^^^^^^^^^
4453

4554
For information not covered in the tutorials and this page, please see
46-
`The Custom Operators Manual <https://docs.google.com/document/d/1_W62p8WJOQQUzPsJYa7s701JXt0qf2OfLub2sbkHOaU>`_
47-
(we're working on moving the information to our docs site). We recommend that you
55+
`The Custom Operators Manual <https://docs.pytorch.org/docs/main/notes/custom_operators.html>`_.
56+
We recommend that you
4857
first read one of the tutorials above and then use the Custom Operators Manual as a reference;
4958
it is not meant to be read head to toe.
5059

advanced_source/python_custom_ops.py

Lines changed: 0 additions & 278 deletions
This file was deleted.

0 commit comments

Comments
 (0)