EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home Data Science Data Science Tutorials TensorFlow Tutorial Tensorflow Basics
 

Tensorflow Basics

Priya Pedamkar
Article byPriya Pedamkar

Updated April 20, 2023

Tensorflow Basics

 

 

Introduction to Tensorflow

Tensorflow is open-source software and a library. It was developed by the Google Brain team built by a deep learning artificial intelligence research team at Google 2010. Google was using it for internal use after that it was released under Apache2.0 Open source – 2015. In this topic, we are going to learn about TensorFlow Basics.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Tensorflow is Google brain’s second-generation system. Version 1 was released on Feb 11, 2017. Tensorflow 1.0 now had Python API and API for Java and GO language is also added to version 1.0. Tensorflow operations neural network performed on a multidimensional data array, which is referred to as a tensor. It works with Tensors. It is a software library for deep learning and mainly works for numerical computation using data flow graphs.

What are Tensorflow Basics?

Tensors are objects that describe the linear relation between vectors, scalars, and other tensors. Tensors are nothing but multidimensional arrays. Tensorflow provides support to write the code according to your requirements and access to different kinds of tools. For example, we can write code in C++ and can call C++ code from python. Or we can write Python code and call it by C++.

What is Tensorflow Basics

The lowest layer it supports two languages first is Python language and the second C++ language. You can write it in any language in your comfort zone. It has a collection of different math libraries that help to create math functions easily.

It also provides support for processing like CPU, GPU, and TPU and also runs on Android mobiles.

  • Tf.layers: tf.layers are used for method abstract so that you can customize the layers of neural networks.
  • Tf.estimator: most commonly used API in TensorFlow is the tf.estimator. It helps in create and train, test your model.

Installation of Tensorflow

  • First, check your pip version; if not the latest, then run the following command to upgrade pip.
pip install –upgrade pip
  • Run the below code to install the simpler version of Tensorflow.
pip install tensorflow / conda install tensorflow (Anaconda)
  • This will install Tensorflow with GPU supported configurations.
pip install Tensorflow-gpu

Example of tf.estimator to Use Classifier by 3 Lines of Code

Code:

import tensorflow as tf
classifier = tf.estimator.LinearClassifier(feature_columns)
classifier.train(input_fn=train_input_function, steps=2000)
predictions = classifier.predict(input_fn=predict_input_function)

Basic Data Types of Tensorflow

The basic data types in the Tensorflow framework (Tensors).

Below shows each dimension of tensors:

  • Scalar – O Dimensional Array
  • Vector – 1 Dimensional Array
  • Matrix – 2 Dimensional Array
  • 3D Tensor – 3 Dimensional Array
  • N – D Tensor – N-dimensional array

Constant Tensors

Given below are constant tensors:

1. Variables

tf.Variable class, for creating a variable in TensorFlow and calling the tf.get_variable function.

Initializing Variables

To initialize the variables, By calling tf.global_variables_initializer, we can initialize all the variables.

A simple example of variable and Math expression

Normal way:

a = 3.0, b = 8*a +10

Tensorflow way:

c = tf.Variable (tf.add (tf.multiply (X, a), b)

2. Graphs

Every line in our code written in TensorFlow is converted into an underlying chart.

Example:

Graphs

tensorFlow Basics 2

  • Nodes: It represents mathematical operations.
  • Edges: it represents the multidimensional array (Tensors) and shows how they communicate between them.

3. Tensorflow 2.0

  • In the second version of Tensorflow, they focused on making the API simpler and easy to use.
  • The API components integrate better with Keras; by default, the eager execution mode is activated.
  • Eager Mode: Eager execution is a run interface where operations are executed immediately as they are called Python.
  • We can use eager mode instead of graph mode. We can compute what we need to compute, and we can get results right away. This will make Tensorflow as easy as Pytorch.
  • Focusing on removing duplication APIs.

4. Keras

  • Tensorflow provides a high-level API for building and training deep learning models. This was not included in TensorFlow, but in the latest release, Keras has been included in Tensorflow 2.0.
  • User-friendly: Keras provides a simple, consistent interface for common use cases.
  • Modular and composable: Keras models are made by connecting building blocks together.
  • Easy to extend: Create or update new layers, metrics, loss functions.
  • Use tf.keras for using Keras models.

5. Tensorflow Lite

  • In 2017, Google announced software that is specifically built for mobile development, Tensorflow Lite.
  • Tensorflow Lite (TFLite) is a lightweight solution for on- Mobile device inference.
  • We can also use it for IOS and Android by creating C++ API, as well as we can also use the Java wrapper class for Android Developers.

List of Algorithm that Tensorflow Supports

Given below is the list mentioned:

1. For Regression

  • Linear Regression (tf.estimator. Linear Regression)
  • Booster tree Regression (tf.estimator. Boosted Tree Regressor)

2. For Classification

  • Classification (tf.estimator. Linear Classifier)
  • Deep Learning Combined (tf.estimator. DNNLinearCombinedClassifier)
  • Boosted tree classifier (tf.estimator. Boosted Tree Classifier)

Features of Tensorflow

Given below are the features mentioned:

  • Tensorflow works Efficiently with different types of mathematical expressions involving Multidimensional arrays(Tensors).
  • It also provides support for deep learning neural networks and other machine learning concepts.
  • Tensorflow can run on multiple CPUs and GPUs.
  • It also provides its own processing power that is the Tensor Processing Unit.

Tensor Processing Unit (TPU)

  • Google announced its Tensor processing unit(TPU), an application-specific integrated circuit(Hardware Chip), built specifically for Machine Learning and tailored for Tensorflow.
  • In 2017, Google announced the second version of Tensorflow and the availability of the TPUs in google cloud.
  • TPU is a programmable AI accelerator and built for using or running models. Google running TPUs inside their data centres for more than a year.

Edge TPU

  • Edge TPU is a chip that googles built to design and run TensorFlow Lite machine learning (ML) models on small computing devices such as smartphones.
  • High scalability for computing huge datasets.
  • It can also train and serve models in a live model. Rewriting of code I not required.

Conclusion – Tensorflow Basics

Tensorflow is a very commonly used deep learning library. That is mostly used in creating neural networks, also used by startup companies, big companies. As seen above, Google is also using TensorFlow for its internal purpose; it is still used in mostly all kinds of products like Gmail and google search engine.

Recommended Articles

We hope that this EDUCBA information on “Tensorflow Basics” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

  1. What is TensorFlow?
  2. TensorFlow Alternatives
  3. Introduction to Tensorflow
  4. How to Install TensorFlow

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - 🎁 ENROLL NOW