A day with .Net

My day to day experince in .net

Archive for the ‘Tensorflow’ Category

Visualise Computational Graphs with Tensorboard and Tensorflow

Posted by vivekcek on August 6, 2017

In this post i will show , how you can visualise computational graphs created by tensorflow bu using tensorboard.

I am using visual studio for tensorflow development in windows. Refer my previous blog to setup tensor flow in windows Installing tensorflow in windows

Hope the reader has some basic understanding of tensorflow. Tensorflow execute every operation by building computational graphs. To visualize such graph we use tensorboard.

Tensorboard is a visualisation tool that will be installed as a part of tensorflow installation.

Write below code in visual studio. In this code we declare four constants, then we multiply ‘a’ and b’ after that we divide ‘c’ and ‘d’ then result of both were added to produce the final output.

import tensorflow as tf




output =sess.run(addn)

These line actually help us to create graphs for above computation. Here “visual” is a folder created in your running directory.


Now go to your running directory and execute below command.

tensorboard --logdir="visual"

Now browse to the link and see the graph.

Posted in Tensorflow | Tagged: , , , , | Leave a Comment »

Installing Tensorflow in Windows and Visual Studio – Deep learning.

Posted by vivekcek on March 25, 2017

Recently i was working with designing a chat-bot with Microsoft bot framework.
And i was using a combination of Retrieval based model and Intent/Entity based model.

During the research i decided to include some deep learning into the bot with a Generative Model.
Because generative Models will be the future of chat bot’s.

So i decided to play with Google’s tensorflow for deep learning implementation.
As i am a .NET guy, i like to do all my experiments with Visual Studio.
Then i googled and found that we can integrate tensorflow with Visual Studio.

So how can we do that? First we need to have below software requirements.

1. A 64 bit Windows.
2. Visual studio 2015.

Now download 64 bit Python 3.5, You can have it from below link.

Install python, Please ensure that you selected the “Add Python 3.5 to PATH”

Now open the Command Prompt in Administrator Mode.
Then check the Python Version, by using below commands and ensure that you have 3.5 , 64 bit version.

python --version

Now we need to update pip, Issue the below command.

python -m pip install --upgrade pip

Now install the CPU mode tensorflow by using below command.

pip install tensorflow

Now try this code in your python prompt.

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

Now to do python in visual studio, we need to install Python Tools For Visual Studio.
Have it from this link https://github.com/Microsoft/PTVS

After successful installation create a python application in Visual studio.

Add below code in your file and run.

import tensorflow as tf
hello = tf.constant('Hello, Tensorflow on Windows!')
sess = tf.Session()

Posted in Tensorflow | Tagged: , , , | Leave a Comment »