Tuesday, August 2, 2016

Tensorflow on Windows

Get tensorflow installed and working on Windows.
  • Download docker toolbox for windows from https://www.docker.com/products/docker-toolbox
    Use default selections, once installed it will create few shortcuts on your desktop.
  • Click on "Docker Quickstart Terminal" shortcut on desktop
  • Now press Windows key + R and type cmd, it will open new command terminal. Enter following in terminal
     docker-machine ssh default 
  • Start docker using below command
     docker run -it b.gcr.io/tensorflow/tensorflow:latest-devel 

    If Its first time it will display following error and download it, which takes some time. Unable to find image 'b.gcr.io/tensorflow/tensorflow:latest-devel' locally latest-devel: Pulling from tensorflow/tensorflow
  • check tensorflow, by typing following
    >>> import tensorflow as tf
    >>> msg = tf.constant("Hello, World")
    >>> sess = tf.Session()
    >>> print sess.run(msg)
    Hello, World
  • To use windows shared folder with docker

  • Click "Oracle VM VirtualBox" shortcut on desktop.
  • Goto Settings-> "Shared Folders"
  • Click Folder+ Icon
  • Provide Folder Path, Folder Name, check Automount. e.g. I have folder name as dl_share
  • Now start docker by mounting share folder dl_share to /home/
    docker-machine ssh default
    sudo mkdir /win-share
    sudo mount -t vboxsf dl_share /win-share
    docker run -it -v /win-share:/home b.gcr.io/tensorflow/tensorflow:latest-devel

  • No comments:

    Post a Comment