Delivering PyTorch Inference acceleration as plug-in to PyTorch

Instead of modifying PyTorch code to incorporate acceleration for a specific target hardware (say AMD CPU) and building PyTorch code and delivering modified PyTorch (or upstreaming later on), is there a way to deliver acceleration as a plug-in where a user can install a plug-in on top of an already installed PyTorch version? Any pointer to the right way of doing so would be great. Thank you!

Tensor subclasses should be what you’re looking for subclass_zoo/ at main · albanD/subclass_zoo · GitHub