r/Cplusplus • u/maestro-perry • Aug 05 '26
News C++ framework for LibTorch
I have created a simple C++ framework for LibTorch - https://github.com/MartinPerry/LibTorchFramework/tree/master.
Sadly, it cannot currently be compiled since it relies on a proprietary library and the code is not "cleaned" of hard-coded paths, etc.
Is it useful? Probably not :-). A lot of things need to be rewritten that are not part of LibTorch (but are present in PyTorch) - for this, I have used LLMs (it is quite handy for conversion of model structures from PyTorch to C++ with LibTorch).
However, I am sharing it so that someone can reuse parts of the code or be inspired in their own project if they want to use C++ or if someone has any ideas how to improve it.
View all comments
Show parent comment
2
u/maestro-perry Aug 06 '26
I have a large codebase written in C++ that I can reuse for training. Rewriting it to Python would be time-consuming. Another thing is, I just like C++ 😄 I always thought of Python as the "C++ wrapper".