mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Generally, to extend PyTorch with custom operators, a user will create a Python module whose import triggers registration of the custom operators via a torch.ops.load_library call or a call to one or more torch.library.* APIs. It is unexpected for Python modules to have side effects, so some linters and formatters will complain. Use torch.ops.import_module to import the module without a linter or formatter complaining. NB: A more robust API would actually check if a custom op was registered or modified, but this is technically challenging to do. In the future we can add a warning if a custom op wasn't registered or modified. Test Plan: - existing tests Pull Request resolved: https://github.com/pytorch/pytorch/pull/110090 Approved by: https://github.com/ezyang |
||
|---|---|---|
| .. | ||
| CMakeLists.txt | ||
| model.py | ||
| my_custom_ops.py | ||
| my_custom_ops2.py | ||
| op.cpp | ||
| op.h | ||
| test_custom_ops.cpp | ||
| test_custom_ops.py | ||