TensorFlow

About

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. Install Anaconda software by following simple steps of wizard and install the software in it's default directory.

Go To https://www.continuum.io/downloads website

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/

Go To https://www.jetbrains.com/pycharm/ website
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

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.

STEP 1:

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.

Go To https://www.continuum.io/downloads website

STEP 2:

Download PyCharm from https://www.jetbrains.com/pycharm/download/#section=mac and Drag use the package to drag the package to the applications folder.

Go To https://www.jetbrains.com/pycharm/download/#section=mac

STEP 3:

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.

Project creation in tensorflow

STEP 4.

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

STEP 5.

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!

Expected Output :
Output on console of Tensorflow installation on mac

The article "Installing TensorFlow in Mac" was contributed by Sushant Shekhar ,follow Sushant Shekhar on GitHub at https://github.com/sushantshekhar20/