Back To Top

Beginner’s guide to Tensorflow


The primary software tool of Deep Learning is TensorFlow. It is an open source artificial intelligence library, using data flow graphs to build models. It allows developers to create large-scale neural networks with many layers

USED FOR: TensorFlow is mainly used for:

1. Voice/Sound Recognition

2. Text Based Applications

3. Image Recognition

4. Video Detection


Nasa ( National Aeronautics and Space Administration) is designing a system with TensorFlow for orbit classification and object clustering of asteroids. As a result, they can classify and predict NEOs (near earth objects). (So, in a way TensorFlow is life-saving!!!)


TensorFlow is a library for numerical computation where data flows through the graph.

Data in TensorFlow is represented by n-dimensional arrays called Tensors.

Graph is made of data(Tensors) and mathematical operations.

1. Nodes on the graph: represent mathematical operations.

2. Edges on the graph: represent the Tensors that flow between operations.

There is one more aspect in which TensorFlow is very different from any other programming language.

In TensorFlow, you first need to create a blueprint of whatever you want to create. While you are creating the graph, variables don’t have any value. Later when you have created the complete graph, you have to run it inside a session, only then the variables have any values.

import tensorflow as tf

Graph in TensorFlow:

GRAPH is the backbone of TensorFlow and every computation/operation/variables reside on the graph. Everything that happens in the code, resides on a default graph provided by TensorFlow. You can access this graph by:

graph = tf.get_default_graph()

Next big thing, Session!

A GRAPH is used to define operations, but the operations can only run within a SESSION. Graphs and sessions are created independently of each other.

Sess = tf.Session()

Tensors in Tensorflow:

TensorFlow holds Data in tensors

i) Constants are constants whose value can’t be changed. You can declare a constant like this:a=tf.constant(1.0)

ii) Variables are again Tensors which are like variables in any other language.


iii) PlaceHolders are tensors which are waiting to be initialized/fed. Placeholders are used for training data which is only fed when the code is actually run inside a session. What is fed to Placeholder is called feed_dict. Feed_dict are key value pairs for holding data:

a = tf.placeholder(“float”)