Hi, i’m very interested in the implementation details of pytorch, i’ve been trying to read some source code of pytorch but i cannot seem to find a good way, can anyone show me how pytorch integrate python with c/c++? why not use numpy for numerical computation but use c/c++ dynamic lib instead? For extending python with c/c++, which is the best choice, cffi, ctype, cython? Thanks very much!
1 Like
why not use numpy for numerical computation but use c/c++ dynamic lib instead?
Because numpy does not have GPU support.
For extending python with c/c++, which is the best choice, cffi, ctype, cython?
Internally we use our own C wrapper engine: https://github.com/pytorch/pytorch/tree/master/tools/cwrap
For end-users, we recommend that they use CFFI GitHub - pytorch/extension-ffi: Examples of C extensions for PyTorch
6 Likes
Doesn’t CFFI not support C++?
I’m looking at starting a project that at the outset appears to need
- lua (for interacting with adobe lightroom)
- C++ (for interacting with Adobe’s XML SDK)
- Python (For building models in PyTorch)
I think this will be my biggest attempted project ever, and I only know a little C++ and no Lua.
Any advice?
Also, why do you guys use your own wrapper engine? Do the common ones not meet your needs?