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
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. Install Anaconda software by following simple steps of wizard and install the software in it's default directory.
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
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.
Now, in the "Create Package" Window interpreter location is changed to anaconda environment. Click "create" and open the project in a new window.
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
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
Get the latest version of pip sudo apt-ge t install python-pip python-dev
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
Installing TensorFlow in Mac
These simple instructions will help you to install TensorFlow on Mac OS X.
Please Note: As of version 1.2, TensorFlow no longer provides GPU support on Mac OS X.
Get Python package called Anaconda Simply Google "Anaconda Python" and Go to https://www.continuum.io/downloads and download Python 3.6 Graphics Installer. Install Anaconda using the Installer.
Open Pi Charm, CLick on Create New Project. On left pane, choose Pure Python.Next, Choose a location by changing the "untitled" to your project name. Click on Interpreter Dropdown and choose 3.6.1 ~/anaconda/bin/python . Click on create.
Go to "Tools" then "Python Console" then type following commands. it will take some time to download tensorflow. import pip pip.main(['install', 'tensorflow']) This should automatically download and install all dependencies
use command+N to create new python file, paste the code below in the file. 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!