TensorFlow provided base classes for the users to inherit and virtual methods to override for their custom ops in C++. In PyTorch, however, this only happens in Python. Is there any reason why PyTorch designs its current extension interfaces like this? Any plans to provide extension base classes to the users to inherit in the near future? Thank you very much.
Sure, pytorch has provides both python and C++ to extend custom op. Further more, cuda and other accelerate device have been supported. You can refer to pytorch tutorial https://pytorch.org/tutorials/advanced/cpp_extension.html.
@alanzhai219 I checked Peter’s tutorial. Essentially we are creating a C++ function that is bonded to Python using Pybind11. There is no base class of the custom op to inherit in PyTorch C++, where TensorFlow provides a base class of the custom op for users to extend.