TensorFlow Guide for Beginners

I will walk you through the basics with 3 question answers. But Before we start learning about tensorflow, first of all I need you to answer few questions.

  • Who created this API ?​

            ->   It is built by the Google Brain team for solving their Deep Learning problems.​

  • Is it just a mere API ?​

            ->   It is actually much more than that​

  • What special it does ?​

            ->   It creates just a graph until the code is run using sessions. So on every run the data flows through this graphical pipeline and gives results​

So now that you have a fair bit of Idea what exactly this does, so we can move further to our n number of question answers. We will be using python for playing with TensorFlow in this article.

How to install Install Tensorflow on linux, Mac and Windows​?

Two versions of tensorflow are available :​

  1. CPU version :- pip install –upgrade tensorfow​
  2. GPU version :- pip install –upgrade tensorfow-gpu

What is ABC of TensorFlow?

  • Variable and Placeholder : Variables can be understood as the usual set of variables which we use in all the programming languages whose value can be changed later during the program but they require initial value assignment. Whereas Placeholders require just the memory allocation as per the datatype which can be assigned any value later at any point of time using feed_dict.

  • Constants : Once a value is assigned to it, then the value cannot be changed during the execution.

  • Session :   The Graph that we created in the above steps needs to be computed and in TensorFlow the execution for this is done using Session.

  • Gradients and Optimizer :

           Eq1 :- y = mx + c

       Eq2 :- y_given

   The main point of this Learning is to find this Eq1. For this we need m and c for getting the equation right, once we have this equation then we         are done. Basically our model has to give us Eq1 which gets us y and y_given nearly same. So Gradients is a way of finding these variables and Optimizer is a technique of fine tuning the learnt m and c values.


  • Managing Graphs : As TensorFlow is all about creating Computational Graphs and executing them. Hence we have lot of freedom to change from default Graph to another graph which we can see below.

How to use TensorBoard for Visualizing Computation Graphs of TensorFlow?

  • Used for Visualizing the tensorflow computational Graph​
  • Understand the different Scaler Processes​​

Trigger Tensorboard :- tensorboard –logdir  log_dir_name/​

After executing the above command just move to the URL that pops up on your terminal and hence you can see the tensorboard. In case the URL is not working then try to use localhost instead of what popped up on your terminal.

Code available on github :-


8 thoughts on “TensorFlow Guide for Beginners

  1. Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
    Type “help”, “copyright”, “credits” or “license” for more information.
    >>> import tensorflow
    Traceback (most recent call last):
    File “”, line 1, in
    File “C:\Users\Ravi Zala\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py”, line 22, in
    from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
    File “C:\Users\Ravi Zala\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py”, line 52, in
    from tensorflow.core.framework.graph_pb2 import *
    File “C:\Users\Ravi Zala\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\core\framework\graph_pb2.py”, line 6, in
    from google.protobuf import descriptor as _descriptor
    File “C:\Users\Ravi Zala\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\descriptor.py”, line 47, in
    from google.protobuf.pyext import _message
    ImportError: DLL load failed: The specified procedure could not be found.

  2. ImportError Traceback (most recent call last)
    D:\Python_soft\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in ()
    —> 58 from tensorflow.python.pywrap_tensorflow_internal import *
    59 from tensorflow.python.pywrap_tensorflow_internal import __version__

    D:\Python_soft\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in ()
    27 return _mod
    —> 28 _pywrap_tensorflow_internal = swig_import_helper()
    29 del swig_import_helper

    D:\Python_soft\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper()
    23 try:
    —> 24 _mod = imp.load_module(‘_pywrap_tensorflow_internal’, fp, pathname, description)
    25 finally:

    D:\Python_soft\lib\imp.py in load_module(name, file, filename, details)
    242 else:
    –> 243 return load_dynamic(name, filename, file)
    244 elif type_ == PKG_DIRECTORY:

    D:\Python_soft\lib\imp.py in load_dynamic(name, path, file)
    342 name=name, loader=loader, origin=path)
    –> 343 return _load(spec)

    ImportError: DLL load failed: The specified module could not be found.

    During handling of the above exception, another exception occurred:

    ImportError Traceback (most recent call last)
    in ()
    —-> 1 import tensorflow as tf

    D:\Python_soft\lib\site-packages\tensorflow\__init__.py in ()
    21 # pylint: disable=g-bad-import-order
    —> 22 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
    24 try:

    D:\Python_soft\lib\site-packages\tensorflow\python\__init__.py in ()
    47 import numpy as np
    —> 49 from tensorflow.python import pywrap_tensorflow
    51 # Protocol buffers

    D:\Python_soft\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in ()
    72 for some common reasons and solutions. Include the entire stack trace
    73 above this error message when asking for help.””” % traceback.format_exc()
    —> 74 raise ImportError(msg)
    76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

    ImportError: Traceback (most recent call last):
    File “D:\Python_soft\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
    from tensorflow.python.pywrap_tensorflow_internal import *
    File “D:\Python_soft\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 28, in
    _pywrap_tensorflow_internal = swig_import_helper()
    File “D:\Python_soft\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 24, in swig_import_helper
    _mod = imp.load_module(‘_pywrap_tensorflow_internal’, fp, pathname, description)
    File “D:\Python_soft\lib\imp.py”, line 243, in load_module
    return load_dynamic(name, filename, file)
    File “D:\Python_soft\lib\imp.py”, line 343, in load_dynamic
    return _load(spec)
    ImportError: DLL load failed: The specified module could not be found.

    Failed to load the native TensorFlow runtime.

    See https://www.tensorflow.org/install/install_sources#common_installation_problems

    for some common reasons and solutions. Include the entire stack trace
    above this error message when asking for help.

      1. Great !!
        It worked perfectly. It was just that gpu isn’t supported by some platforms.Normal installation of tensorflow works fine and it works perfectly on jupyter notebook too.

        Thanks Salil.

Leave a Reply

Your email address will not be published. Required fields are marked *