[hop] ban creating hop by directly instantiating HigherOrderOperator. (#133645)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/133645
Approved by: https://github.com/zou3519
This commit is contained in:
Yidi Wu
2024-08-22 15:04:18 -07:00
committed by PyTorch MergeBot
parent 3546628a2a
commit a23d86c178
11 changed files with 68 additions and 11 deletions

View File

@ -4989,7 +4989,11 @@ def forward(self, x_1):
def construct_sum_pyop():
mysum = HigherOrderOperator("mysum")
class MySum(HigherOrderOperator):
def __init__(self):
super().__init__("mysum")
mysum = MySum()
@mysum.py_impl(torch._C._functorch.TransformType.Vmap)
def mysum_batch_rule(interpreter, x, dim):