Files
pytorch/test/custom_operator/my_custom_ops2.py
FFFrog 6fc0ad22f0 Using the latest torch.library.register_fake API instead of torch.library.impl_abstract (#158839)
As the title stated.

`torch.library.impl_abstract` have beed deprecated in PyTorch2.4, so change to use the new API.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/158839
Approved by: https://github.com/jingsh, https://github.com/zou3519
ghstack dependencies: #158838
2025-07-25 02:37:30 +00:00

12 lines
212 B
Python

from model import get_custom_op_library_path
import torch
torch.ops.load_library(get_custom_op_library_path())
@torch.library.register_fake("custom::sin")
def sin_abstract(x):
return torch.empty_like(x)