I'm a full stack developer and I've been diving into machine learning algorithms lately. I've heard that Python is slower than C or C++, so I'm curious why libraries like TensorFlow and Keras aren't built in C++ or if they even exist. Does anyone have insight into this?
5 Answers
If you're looking to explore ML programming in C++, there's actually a book dedicated to it! You might want to check it out if you're interested in learning more.
Actually, most of the heavy processing in machine learning libraries like TensorFlow and Keras is handled in C++ or CUDA. Python is just the interface to make it easier to work with models and run them. You can definitely write ML algorithms in C++, but for high-level work, the difference isn't too impactful. It's more about ease of use with Python.
You can absolutely implement ML algorithms in C++. It's just that C++ can be trickier to work with compared to Python. Many people do their initial research and prototype in Python, then translate their models into C++ when they're ready to scale up.
From what I've gathered, TensorFlow and pretty much all significant AI frameworks are indeed written in C++. They use Python primarily for ease of use and accessibility in research and development, while the actual performance-intensive tasks are handled in C++ underneath.
Yes, both Torch and TensorFlow have C++ interfaces, but using them in C++ might not yield performance improvements compared to using them in Python. It's still possible, just less common due to how much easier Python makes things.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically