TensorFlow is an open source software library which allows to build data flow graphs and allows us to better apply numerical computation on it. Thus, it helps us to build deep neural networks. A deep neural network is neural network having two or more hidden layers. In tensorFlow, data are passed using an multidimensional arrays which are called Tensors. In a graph, each node represents mathematical operations and edges of graph represents tensors. This type of architecture is fexible enough to split the computation to two or more CPUs or GPUs. It can be run on a desktop,server, or even an mobile device with a single API.
Installing TensorFlow in Windows
Step 1:
Get Python package called Anaconda Simply Google "Anaconda Python" and Go to https://www.continuum.io/downloads and download the latest version of anaconda for Python 3.6
Step 2:
Open "PyCharm" python IDE, if you don't have PyCharm installed follow these simple instructions to download and install pyCharm Simply google "PyCharm JetBrains" and go to https://www.jetbrains.com/pycharm/
Download the trial professional version or free community version Install PyCharm in Windows
Step 3:
Open "Create Project" window, type in the location and name of the project and in the interpreter click on the right side on the gear to open multiple option and select "Create Conda Env" then specify the name of the new environment(for example "TensorFlowExample")and then click "ok". It will take some time to create a new virtual environment.
Step 4:
Now, in the "Create Package" Window interpreter location is changed to anaconda environment. Click "create" and open the project in a new window.
Step 5:
Go to "Tools" then "Python Console" then type following commands
import pip pip.main(['install', 'tensorflow']) if you have a GPU then u can write ‘tensorflow-gpu' This should automatically download and install all dependencies
Step 6:
Create a new file named "Test.py" and type following HelloWorld Code import tensorflow as tf hello=tf.constant('Hello, TensorFlow!') sess=tf.Session() print(sess.run(hello))
a=tf.constant(10) b=tf.constant(32) print(sess.run(a + b)) Run the code
Installing TensorFlow in Linux
Step 1:
Get the latest version of pip sudo apt-ge t install python-pip python-dev
Step 2:
Install TensorFlow by running any one of the following commands $ pip install tensorflow # Python 2.7; CPU support (no GPU support) $ pip3 install tensorflow # Python 3.n; CPU support (no GPU support) $ pip install tensorflow-gpu # Python 2.7; GPU support $ pip3 install tensorflow-gpu # Python 3.n; GPU support