Understanding Tensorflow
Implementing ML models using Tensorflow will be much easier when we grasp the basic idea of Tensorflow. Recently I went through the course “Introduction to Tensorflow” by Google. Let me share what I understood.
As we all knew Tensorflow is an open-source high-performance library for numerical calculations. It is not only for ML, but it is developed with a greater vision to solve any numerical calculations.
The word Tensor represents an N-dimensional array. It can be a scaler, vector(1-D array), matrix(2-D array) and so on. Each variable/constants/arrays/lists/matrix will be considered as a tensor by the TensorFlow execution engine.
Now a question might arise, What is Tensorflow execution engine? to be simple it is the JVM for Java. Like JVM creates an intermediary bytecode which gives the ability of OS and Hardware independence. Tensorflow execution engine creates the directed graph(collection of Tensors and Nodes) so Tensorflow models can run on any operating system and any procession unit.
Let’s look at the hierarchy of Tensorflow, here two things are really important which made life easier for developers.
Core TensorFlow (C++), which makes TensorFlow OS and Machine level independent and Estimator API which let developers write a program on high-level language regardless of critical mathematical and statistical implementation.
Another important feature of Tensorflow is it supports federated learning. Deployed models (for example an application running on mobile) learn preferences and update the weights accordingly locally only for that specific user.
If you have already used tensor flow or seen tensor flow code, you might be wondered that it will not run as immediately as we execute the program in python. That is because of the Lazy Evaluation happening behind the scene.
Tensorflow execution engine creates the graph using each statement we write for declaration(Tensors) and operations. They won’t be executed until we trigger them explicitly. tf.Session.run is used to trigger the execution of the graph. Lazy Evaluation allows lots of flexibility and optimization when we run the graphs.
Hope these quick note on Tensorflow helps you to understand some fundamentals. If you have any feedback or questions ping me.