NOW TECHNICAL STUFF:
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.
- Nodes on the graph: represent mathematical operations.
- 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”)
Please feel free to Speak one of our AI Expert if you have questions or if you would like to know more.