4 ms·
This is a common trope that does not really match reality. Pytorch readme quote pytorch is not a Python binding into a monolithic C++ framework. It is built
by cdavid 4y ago
This is a common trope that does not really match reality.
Pytorch readme quote
pytorch is not a Python binding into a monolithic C++ framework. It is built to be deeply integrated into Python.
could be applied to many key libraries of this ecosystem.
For sure, a lot of those libraries rely on tons of compiled code in C/C++/Fortran, but the python code is not mere wrapping on top of those libs. And most of the compiled code inside those repos has a lot of internal logic as well.
Some examples (using cloc on git main branch, as tokei does not understand cython):
* sklearn: 150 kloc python, ~10kloc cython, not much of other languages
* NumPy: 200kloc python, 350kloc for C/C++
* scipy: 800 kloc C, 200 kloc python (the 800kloc surprised me and it looks like a lot of it is C generated code from cython)
- pjmlp 4y agoPyTorch might be the exception, except not quite, as proven by the bindings selection on the website, where C++ and Java are also an option.
- cdavid 4y agoBut pytorch is not an exception. Scikit learn, scikit images, statsmodels, matplotlib are not mostly implemented in compiled languages.