EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

Tensorflow Basics

By Priya PedamkarPriya Pedamkar

Home » Data Science » Data Science Tutorials » TensorFlow Tutorial » Tensorflow Basics

Tensorflow Basics

Introduction to Tensorflow

Tensorflow is open-source software and 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.

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 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.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

What is 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 the 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, 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.

Code:

pip install –upgrade pip

  • Run the below code to install the simpler version of Tensorflow.

Code:

pip install tensorflow / conda install tensorflow (Anaconda)

  • This will install Tensorflow with GPU supported configurations.

Code:

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)

Popular Course in this category
Sale
TensorFlow Training (11 Courses, 3+ Projects)11 Online Courses | 3 Hands-on Projects | 55+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.5 (9,197 ratings)
Course Price

View Course

Related Courses
Machine Learning Training (20 Courses, 29+ Projects)Artificial Intelligence Training (5 Courses, 2 Project)

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

This is a guide to Tensorflow Basics. Here we discuss the installation of tensorflow with the features and list of algorithm that tensorflow supports. You may also look at the following article to learn more –

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

TensorFlow Training (11 Courses, 3+ Projects)

11 Online Courses

3 Hands-on Projects

55+ Hours

Verifiable Certificate of Completion

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
TensorFlow Tutorial
  • Basics
    • Introduction to Tensorflow
    • What is TensorFlow?
    • Tensorflow Basics
    • TensorFlow Architecture
    • TensorFlow Versions
    • How to Install TensorFlow
    • Caffe TensorFlow
    • Tensorflow Image Classification
    • TensorFlow Playground
    • TensorFlow RNN
    • TensorFlow Models
    • TensorBoard
    • TensorFlow Debugging
    • TensorFlow vs Keras
    • Tensorflow LSTM
    • TensorFlow Probability
    • TensorFlow Session
    • TensorFlow Dataset
    • TensorFlow Reshape
    • TensorFlow estimator
    • TensorFlow Keras Model
    • TensorFlow Load Model
    • tensorflow transformer
    • tensorflow extended
    • tensorflow flatten
    • TensorFlow OpenCL
    • TensorFlow APIs
    • Tensorflow concatenate
    • Tensorflow variable
    • TensorFlow normalize
    • TensorFlow save model
    • TensorFlow placeholder
    • TensorFlow shape
    • TensorFlow Adam optimizer
    • TensorFlow dense
    • Tensorflow Quantum
    • TensorFlow Layers
    • TensorFlow Distributed
    • TensorFlow Profiler
    • TensorFlow Metrics
    • TensorFlow Transpose
    • TensorFlow Tensor To Numpy
    • TensorFlow Quantization
    • TensorFlow Regression
    • TensorFlow argmax
    • TensorFlow Federated
    • TensorFlow gather
    • TensorFlow Random Forest
    • Tensorflow sequential

Related Courses

TensorFlow Training Course

Machine Learning Courses

Artificial Intelligence Training Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

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

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

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

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

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

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

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

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Independence Day Offer - TensorFlow Training (11 Courses, 3+ Projects) Learn More