Examples of C extensions for PyTorch
Python C C++
Switch branches/tags
Nothing to show
Clone or download
Latest commit 931a9ea Feb 2, 2018
soumith Merge pull request #16 from yf225/c99_flag
Add c99 compile flag to example
Failed to load latest commit information.
package Fixes for python2 Apr 21, 2017
script add c99 flag Feb 2, 2018
.gitignore Initial commit Jan 18, 2017
README.md Add link to pytorch/audio for generic ext. May 10, 2017


PyTorch C FFI examples

In this repository you can find examples showing how to extend PyTorch with custom C code. To use the ffi you need to install the cffi package from pip.

Currently there are two examples:

  • package - a pip distributable package
  • script - compiles the code into a local module, that can be later imported from other files

You may also want to look at pytorch/audio for an example of a type-generic C FFI extension.