Uttar Pradesh, India
Instagram
image

Tensorflow2 environment setup with google colab notebook

Let's start with the practical tutorial on how to set up the environment to write the first program using tensorflow2 and python.

Firstly launch the google colab notebook which is free of cost service provided by Google. 

Here is the below link for opening google colab notebook.

https://colab.research.google.com/

 

One of the most important advantages of using google colab notebook is mostly data science and machine learning required libraries are already installed (like NumPy, pandas,matplotlib ,scikit-learn, and TensorFlow).

 

Step1: Create New Python 3 Notebook

 

The already installed TensorFlow version is 1.15.0

Type the below lines into a notebook and run the cell you get the below results.

 

Sample Code for checking TensorFlow version:

 

import tensorflow as tf

print(tf.__version__)

 

 

O/P:

 

The default version of TensorFlow in Colab will soon switch to TensorFlow 2.x.

We recommend you upgrade now or ensure your notebook will continue to use TensorFlow 1.x via the %tensorflow_version 1.x magic: more info.

1.15.0

 

Step2: Install tensorflow2 into google colab and set this version for the current notebook.

 

 

Sample Code:

 

!pip install tensorflow==2.0.0

%tensorflow_version 2.x

 

import tensorflow as tf

print(tf.__version__)

 

 

You will get the below o/p to the colab console after clicking the play or run the cell button.

 

O/P:

TensorFlow 2.x selected. 

2.1.0

 

Stay tuned for a new blog post for deep learning. In the next article, I will discuss how to build the first deep learning model using tensorflow2 with Keras API.


Comments

Share your thoughts in the comments

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