Saturday 28 October 2017

Installing TensorFlow on Windows




TensorFlow is an open-source software library for machine learning across a range of tasks. According to Wikipedia, it is a symbolic math library, and also used as a system for building and training neural networks to detect and decipher patterns and correlations, analogous to human learning and reasoning. TensorFlow was developed by the Google Brain team and  was released under the Apache 2.0 open source license on 9 November 2015

 This guide explains how to install TensorFlow on Windows.

Determine how to install TensorFlow


You must pick the mechanism by which you install TensorFlow. The supported choices are as follows:
  • "native" pip
  • Anaconda
Native pip installs TensorFlow directly on your system without going through a virtual environment. Since a native pip installation is not walled-off in a separate container, the pip installation might interfere with other Python-based installations on your system. However, if you understand pip and your Python environment, a native pip installation often entails only a single command! Furthermore, if you install with native pip, users can run TensorFlow programs from any directory on the system.
In Anaconda, you may use conda to create a virtual environment. However, within Anaconda, we recommend installing TensorFlow with the pip install command, not with the conda install command.
NOTE: The conda package is community supported, not officially supported. That is, the TensorFlow team neither tests nor maintains this conda package. Use that package at your own risk.

Installing with native pip


If neither of the following versions of Python is installed on your machine, install it now:
-TensorFlow supports Python 3.5.x and 3.6.x on Windows. Note that Python 3 comes with the pip3 package manager, which is the program you'll use to install TensorFlow.

Installing with Anaconda


The Anaconda installation is community supported, not officially supported.
Take the following steps to install TensorFlow in an Anaconda environment:
  1. Follow the instructions on the Anaconda download site to download and install Anaconda.
  2. Create a conda environment named tensorflow by invoking the following command:
C:> conda create -n tensorflow python=3.6


 
  1. Activate the conda environment by issuing the following command:
  2. C:> activate tensorflow
 (tensorflow)C:>  # Your prompt should change
  1. Issue the appropriate command to install TensorFlow inside your conda environment. To install the CPU-only version of TensorFlow, enter the following command:
(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow
To install the GPU version of TensorFlow, enter the following command (on a single line):
(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow-gpu

Validate your installation


Start a terminal.
If you installed through Anaconda, activate your Anaconda environment.
Invoke python from your shell as follows:

$ python

Enter the following short program inside the python interactive shell:


>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))




If the system outputs the following, then you are ready to begin writing TensorFlow programs:
Hello, TensorFlow!

No comments:

Post a Comment