Tensor flow is an open source library for doing numerical computation developed by the **Google Brain** project. Though used mostly for machine learning and deep learning application, the library is flexible enough to conduct general computation.

Computations in tensorflow are expressed as a graph. Nodes in graph represent mathematical operations/transformations while Edges represent the relationship between the different computation that are associated with nodes. The edges can be thought of carrying data to nodes. Since data is mostly multi-dimensional arrays(tensors), the library got its name as Tensorflow.

Tensor flow can run computations on CPUs or GPUs, which means no re writes of algorithms from scripts to different toolkits for scaling systems. It supports **python** and **C++** out of the box.

import tensorflow as tf x = tf.placeholder("float", 3) y = x * 2 print y with tf.Session() as session: result = session.run(y, feed_dict={x: [1, 2, 3]}) print(result)

###### Output

>> python basic_tensor.py Tensor("mul:0", shape=(3,), dtype=float32) [ 2. 4. 6.]

The above code can be thought of as creating a graph with two nodes. X is the entrypoint of the graph which is connected to Y.

The first time we print y we get some funny object and not the value.Its only when we run session.run that tensorflow evaluates y and we get the array value. This property of lazy evaluation is one of the most important properties of tensorflow. Inferring the dependencies not only allows for parallel computations to take place, but also enables tensor flow to evaluate only a subgraph of the whole computation making things even more faster.