What is TensorFlow
What is TensorFlow
Agenda
Why TensorFlow?
What is TensorFlow?
Deep Learning is a subset of Machine Learning and it works on the structure and
functions of a human brain. It learns from data that is unstructured and uses complex
algorithms to train a neural net.
Deep Learning is a subset of Machine Learning and it works on the structure and
functions of a human brain. It learns from data that is unstructured and uses complex
algorithms to train a neural net.
Deep Learning is a subset of Machine Learning and it works on the structure and
functions of a human brain. It learns from data that is unstructured and uses complex
algorithms to train a neural net.
Deep Learning is a subset of Machine Learning and it works on the structure and
functions of a human brain. It learns from data that is unstructured and uses complex
algorithms to train a neural net.
1 2 3 4 5
Has a faster
Provides both C++
compilation time
and Python API’s
than other Deep
that makes it
Learning libraries
easier to work on
like keras and torch
Why TensorFlow?
Has a faster
Provides both C++
compilation time
and Python API’s
than other Deep
that makes it
Learning libraries
easier to work on
like keras and torch
TensorFlow
supports both
CPU’s and GPU’s
computing devices
What is TensorFlow?
5
Accepts data in the form of multidimensional arrays of higher dimensions
called Tensors 7
Edges 8
1
Works on the basis of Data Flow graphs that have nodes and edges
Nodes
What is TensorFlow?
5
Accepts data in the form of multidimensional arrays of higher dimensions
called Tensors 7
Edges 8
1
Works on the basis of Data Flow graphs that have nodes and edges
Nodes
What is TensorFlow?
5
Accepts data in the form of multidimensional arrays of higher dimensions
called Tensors 7
Edges 8
1
Works on the basis of Data Flow graphs that have nodes and edges
Nodes
What is TensorFlow?
5
Accepts data in the form of multidimensional arrays of higher dimensions
called Tensors 7
Edges 8
1
Works on the basis of Data Flow graphs that have nodes and edges
Nodes
What are Tensors?
Tensors
3 5 4
2 6 7
Data in the form of 8 1 3
arrays is fed as input
to the network 2 5 9
1 4 2
Tensors
q
What are Tensors?
Tensors
1 3 4 7
9 7 3 2
6 3 9 1
3 1 5 9
What are Tensors?
Tensors
s= [200] v=[10,11,12]
t=[[[1],[2],[3]],[[4],[5],[6]],
[[7],[8],[9]]] m=V=[1,2,3],[4,5,6]
What is a Data Flow graph?
Building a
computational Step 1
graph
TensorFlow
programs
work on two
basic concept
Executing a
computational Step 2
graph
Program Elements in TensorFlow
Example:
a = tf.constant(2.0, tf.float32)
b = tf.constant(3.0)
Print(a, b)
Program Elements in TensorFlow
Example:
a = tf.placeholder(tf.float32)
b = a*2
with tf.Session() as sess: feed_dict specifies tensors
result = sess.run(b,feed_dict={a:3.0})
that provide concrete
print result values to the placeholders
Program Elements in TensorFlow
Example:
W = tf.Variable([.3],dtype=tf.float32)
b = tf.Variable([-.3],dtype=tf.float32)
x = tf.Placeholder(tf.float32)
linear_model = W*x+b
Program Elements in TensorFlow
Example:
a = tf.constant(5.0) 5.0
Multiplication
b = tf.constant(3.0) 15.0
c = a*b
# Launch Session
sess = tf.Session() 3.0
# Evaluate the tensor c
print(sess.run(c))
Running a Computation
Graph
TensorFlow program basics
Variables in TensorFlow
TensorFlow program basics
Placeholders in TensorFlow
TensorFlow program basics
TensorFlow Graphs
Use case Implementation using TensorFlow
Lets use various features of an individual to predict what class of income they belong to (>50k or <=50k)
using a Census Data.
native_country
workclass occupation capital_gain
income_bracket
education relationship capital_loss
Predict Income
race hours_per_week
education_num
Use case Implementation using TensorFlow
1. Read the census_data.csv using pandas library
6. Create the feature columns for the continuous values using numeric_column
Use case Implementation using TensorFlow
7. Put all these variables into a single list with the variable name feat_cols