PyTorch C/CUDA Module Template

PyTorch has become a standard library in deep learning. While many neural networks layer can easily be implemented using the operations provided by PyTorch, there are still some special operations where this may seem difficult. In these cases, it might make sense to use C/CUDA implementations and interface them to PyTorch. This repository includes a template of how to do this using PyThon's C Foreign Function Interface (CFFI) and CuPy:

Also check out the corresponding blog article: Implementing Custom PyTorch Tensor Operations in C and CUDA.

PyTorch C/CUDA Template on GitHub