pytorch/torch/_library/__init__.py
rzou 9e8d2b6de2 Add register_autograd to register backward formulas for custom ops (#123110)
The user provides a `setup_context` and a `backward_function`. These
get put into a torch.autograd.Function that gets registered as the
custom op's autograd implementation.

Test Plan:
- we update custom ops in the custom_op_db to use the new
  register_autograd API.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/123110
Approved by: https://github.com/albanD
ghstack dependencies: #123108, #123109
2024-04-05 22:03:47 +00:00

6 lines
201 B
Python

import torch._library.abstract_impl
import torch._library.autograd
import torch._library.simple_registry
import torch._library.utils
from torch._library.fake_class_registry import register_fake_class