Well, pytorch provides a way to do so. https://pytorch.org/tutorials/advanced/c_extension.html, however I never did it, thus can’t not recommend a more developed link, Pretty sure you can sucessfully google it