The Ultimate Beginner Guide to TensorFlow
How To implement linear regression and gradient descent from scratch!
Why TensorFlow? We already have Keras!

When we build a machine learning model, for example, a convolutional neural network for classifying images, we usually design our network on top of high-level libraries such as Keras.
At the end of the day, a Keras model is converted into a TensorFlow program.
What is TensorFlow?
TensorFlow, open sourced to the public by Google in 2015, is the result of years of lessons learned from a dilemma: should we attempt to do research with inflexible libraries so that we don’t have to reimplement code, or should we use one library for research and a completely different library for production?
TensorFlow was made to be flexible, efficient, extensible, and portable (source). Computers of any shape and size can run it, from smartphones all the way up to huge computing clusters. TensorFlow embraces both open source communities and stability of a large corporation.
While TensorFlow is primarily used to refer to the API used to build and train machine learning models, TensorFlow is, in fact, a bundle of software:
- TensorFlow API which is accessed through a user-friendly environment in Python Keras, while the actual computation is written in C++ for efficiency.
- TensorBoard, a graph visualization software that can give insight into a model’s behavior. This is very useful for analyzing training and for debugging TensorFlow code.
- TensorFlow Serving, a high-performance lightweight server that can take input data, pass it to the trained model, and return the output from the model. Moreover, it can seamlessly switch out old models with new ones, without any downtime for end-users.
Why TensorFlow, and not Keras?
Now, we were asking, why should you use TensorFlow directly, when you already have Keras? Per analogy, why should you develop HTML code when you have Wordpress for building websites?
Well, if you are researching new machine learning architectures, TensorFlow is incredibly flexible and useful for your imagination. Usually, you take models from recent research literature and implement them in TensorFlow, not in Keras.
Moreover, if you are in an agile environment, that requires your models to go to production fast and in short iterations, TensorFlow can give your team the ability to get your product off the ground while scaling up over many devices, including Android devices and mini-computers such as the Raspberry Pi. You can easily deploy your models to run inside web pages on client’s web browser!
Computation Graphs
A model in TensorFlow is represented by computation graph, that is like a series of functions chained together, each passing its output to other functions further along in the chain.
Nodes of the graph are circles, ovals, or boxes, representing some sort of operation. Edges are the actual values that get passed to and from operations, and are typically drawn as arrows. Below, you see a simple graph where the data is traveling from left to right to compute (5*3) + (5+3).

Data is referred to as tensors, which are simply the n-dimensional abstraction of matrices.
Below you can see what it looks like in TensorFlow code.









