Skip to content

Conversation

@mikaylagawarecki
Copy link
Contributor

@mikaylagawarecki mikaylagawarecki commented Dec 16, 2025

Description

Migrate advanced_source/cpp_custom_ops.rst to libtorch stable ABI/API. Accompanying change to extension-cpp

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnecessary issues are included into this pull request.

cc @zou3519

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 16, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3701

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 2 Pending

As of commit 919d88d with merge base 10eefc3 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Use ``torch.library.register_autograd`` to add training support for an operator. Prefer
this over directly using Python ``torch.autograd.Function`` or C++ ``torch::autograd::Function``;
you must use those in a very specific way to avoid silent incorrectness (see
this over directly using Python ``torch.autograd.Function`` (see
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove reference to torch::autograd::Function since we don't support that in stable API/ABI

@mikaylagawarecki mikaylagawarecki marked this pull request as ready for review December 16, 2025 21:36
@svekars svekars added the module: custom-operators PRs related to custom ops tutorials label Jan 4, 2026
Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that you want to push the new stable abi APIs, but I do want the tutorial to read well for both stable abi APIs and the old non-abi-stable APIs. Right now the tutorial is fairly centered around stable abi APIs and reduces the information about the non-abi-stable APIs. Why not have two versions of this tutorial, or, for each code snippet, have one code snippet that is abi-stable and one that is non-abi-stable (this works better if we support collapsible sections, which I'm not sure about)? Then we can have a note at the top to tell the user about the tradeoffs and what they should pick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed module: custom-operators PRs related to custom ops tutorials

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants