torch.library =================================== .. py:module:: torch.library .. currentmodule:: torch.library torch.library is a collection of APIs for extending PyTorch's core library of operators. It contains utilities for creating new custom operators as well as extending operators defined with PyTorch's C++ operator registration APIs (e.g. aten operators). For a detailed guide on effectively using these APIs, please see `this gdoc `_ Use :func:`torch.library.define` to define new custom operators. Use the impl methods, such as :func:`torch.library.impl` and func:`torch.library.impl_abstract`, to add implementations for any operators (they may have been created using :func:`torch.library.define` or via PyTorch's C++ operator registration APIs). .. autofunction:: define .. autofunction:: impl .. autofunction:: impl_abstract .. autofunction:: get_ctx Low-level APIs -------------- The following APIs are direct bindings to PyTorch's C++ low-level operator registration APIs. .. warning:: The low-level operator registration APIs and the PyTorch Dispatcher are a complicated PyTorch concept. We recommend you use the higher level APIs above (that do not require a torch.library.Library object) when possible. This blog post `_ is a good starting point to learn about the PyTorch Dispatcher. A tutorial that walks you through some examples on how to use this API is available on `Google Colab `_. .. autoclass:: torch.library.Library :members: .. autofunction:: fallthrough_kernel