Can I build a Convolution Neural Network that goes faster than tensorflow?

My question is simple: What is the purpose of using tensorflow? If I build a CNN on CUDA C/C++ can’t go faster than tensorflow both in training stage and the decision stage? What I mean is that if someone build a CNN for the specific image resolution camera he has, can’t this optimized and run faster than tensorflow? What is the usage of tensorflow anyway? I googled my question but from the answers I got I got more confused… Thanks!

As I see it, the primary purpose of a deep learning framework like TensorFlow is to make it possible to build and test the accuracy of a wide variety of models. Say you build your favorite CNN in CUDA C/C++. Once you have it working you are sure to think of some improvements. To implement those, you wouldn’t start a new CUDA C/C++ project from scratch. Similarly, DL frameworks like TensorFlow and Pytorch provide the common building blocks that researchers have already found to be useful. Researchers have also interfaced these components for easy composability (generally with python).

To be sure, python interfaces and using ‘left over’ or overly generalized components can come at a performance cost, but researchers generally find that, even with this extra performance cost, they are able to experiment with many more networks than would be possible if they traded their current model design efforts for additional low-level optimization.

Also, it is important not to underestimate the effort to implement optimized implementations of things like convolutions, matrix multiplications, reductions, etc. Using pre-built components, even where they are not optimal in ways we can identify, can be (and often are) faster in ways that we may not appreciate at present.

Some final food for thought. Languages like C and C++ rest on similar performance/usability trade-offs as the frameworks. Two generations ago, a similar question was frequently asked. “What is C/C++ for? If I build my application in assembly, can’t this be optimized and run faster than C/C++?” Indeed, a generation from now, DL frameworks will almost certainly be classified as compilers themselves.

Hope that helps.