Getting Started with TensorFlow

Virbhadra Kaulwar
Analytics Vidhya
Published in
4 min readAug 26, 2020

--

An end-to-end open-source platform for Machine Learning

Source: wired.com

Before we start with TensorFlow, we will need to know what machine learning and deep learning technologies are. Machine Learning is an application of Artificial Intelligence which provides automation to systems where Machine or System can learn on its own and It may improve based on previous experience and it can be done without external programming. Deep Learning is the next part of machine learning. Which more focuses on algorithms that are inspired by the structure and functioning of the human brain. Deep learning models sometimes achieve higher accuracies because it uses neural networks to perform tasks. This is where we use TensorFlow because it largely deals with deep neural networks.

TensorFlow

Tensorflow is an open-source library developed by Google and nowadays it has become a more powerful tool to run complex computations. Deep learning has two libraries named Keras and PyTorch which are now replaced by TensorFlow.Because TensorFlow has faster compilation time than these libraries. In reality, Tensorflow performs a huge amount of computations it deals with a higher amount of data such as images. It accepts data in multidimensional arrays called “Tensors”. Tensorflow handles data in the form of graphs by creating neural networks whenever there is a necessity. It also facilitates APIs (Application programming interfaces that are used for connecting different codes or applications)for machine learning. once accessing of data is done then there is no stopping TensorFlow automatically takes care of the rest of the things from creating a required neural network, parsing required data. In Tf computation in each iteration represented by the data flow graph because it does not follow the traditional programming approach.TensorFlow works fine on both CPU and GPU(capability to do higher computations and it contains higher power than CPU)computing devices. So using TensorFlow makes life easier.

Installing TensorFlow

Step 1: To install TensorFlow It is important to have python installed on your system. To check whether it is installed or not just type ”python” in the command prompt if not then install python from here.

Step 2: To run TensorFlow we need some framework for that we will install Anaconda framework. You can install anaconda from here

Step 3: Verify whether anaconda is installed properly or not by entering following command on command prompt

C:\Users\Ultimate>conda

Step 4: Initialize the installation of TensorFlow from the following command

conda create --name tensorflow python = 3.8

Step 5: After completing environmental setup it’s essential to activate TensorFlow by typing the command in the command prompt

activate tensorflow

Step 6: We activated TensorFlow now use a command called pip which is generally used for executing and installing modules in python.

pip install tensorflow  &  pip install tensorflow-gpu

Step 7: Now we Successfully installed TensorFlow into our machine, So its time to run the first “Hello World” code. Follow the sequence of following commands and run them on prompt.

>> activate tensorflow
>> python (activating python shell)
>> import tensorflow as tf
>> hello = tf.constant(‘Hello, Tensorflow!’)
>> sess = tf.Session()
>> print(sess.run(hello))

Google Collab

Google Collab is a real-time environment. You can run your TensorFlow codes easily through google collab. Tutorials are also available where one can learn TensorFlow with practical examples.

The latest version of TensorFlow(2.0) is here. A variety of practice coding examples and multiple inbuilt datasets are available to run the Tf codes easily. To play with the neural networks here is the online playground where we can create, modify, and run our neural networks.

For references and examples use following official Github repo of TensorFlow

--

--