1 of 27

Deep Learning Frameworks

Dr. Dinesh K. Vishwakarma

PROFESSOR, DEPARTMENT OF INFORMATION TECHNOLOGY

DELHI TECHNOLOGICAL UNIVERSITY, DELHI.

Webpage: http://www.dtu.ac.in/Web/Departments/InformationTechnology/faculty/dkvishwakarma.php

Email: dinesh@dtu.ac.in

2 of 27

Outlines

    • Objectives
    • Introduction of popular frameworks for DL
      • TensorFlow
      • Keras
      • PyTorch
      • Caffe
      • MxNet Apache
    • Comparison
      • Code + models
      • Community and documentation
      • Performance
    • Which framework to choose when ..?

Dinesh K. Vishwakarma, Ph.D.

2

4/29/26

3 of 27

Objectives

    • Create a outline of deep-learning frameworks to allow data-scientists to easily leverage their expertise from one framework to another.
    • Optimised GPU code with using the most up-to-date highest-level APIs.
    • Common setup for comparisons across GPUs (potentially CUDA versions and precision).
    • Common setup for comparisons across languages (Python, Julia, R).
    • Possibility to verify expected performance of own installation.
    • Collaboration between different open-source communities.

Dinesh K. Vishwakarma, Ph.D.

3

4/29/26

4 of 27

Introduction

Dinesh K. Vishwakarma, Ph.D.

4

4/29/26

TensorFlow

Google Brain, 2015 (rewritten DistBelief)

Keras

François Chollet, 2015 (now at Google)

PyTorch/Torch

Caffe

Berkeley Vision and Learning Center (BVLC), 2013

MaxNet

5 of 27

TensorFlow: Introduction

    • TensorFlow is an end-to-end open source platform for machine learning. It has a comprehensive, flexible ecosystem of tools, libraries and community resources that lets researchers push the state-of-the-art in ML and developers easily build and deploy ML powered applications. First in 2015 and stable version available in 2017.
    • Easy model building
      • Build and train ML models easily using intuitive high-level APIs like Keras with eager execution, which makes for immediate model iteration and easy debugging.
    • Robust ML production anywhere
      • Easily train and deploy models in the cloud, on-prem, in the browser, or on-device no matter what language you use.
    • Powerful experimentation for research
      • A simple and flexible architecture to take new ideas from concept to code, to state-of-the-art models, and to publication faster.

Dinesh K. Vishwakarma, Ph.D.

5

4/29/26

6 of 27

TensorFlow: Architecture

    • Tensorflow architecture works in three parts:
      • Preprocessing the data
      • Build the model
      • Train and estimate the model
    • It is called Tensorflow because it takes input as a multi-dimensional array, also known as tensors.
    • A sort of flowchart (called a Graph) can be constructed to perform any operation on input. The input goes in at one end, and then it flows through this system of multiple operations and comes out the other end as output.
    • This is why it is called TensorFlow because the tensor goes in it flows through a list of operations, and then it comes out the other side.

Dinesh K. Vishwakarma, Ph.D.

6

4/29/26

7 of 27

TensorFlow: Computational Graph

    • TensorFlow makes use of a graph framework. The graph gathers and describes all the series computations done during the training. The graph has lots of advantages:
        • Run on multiple CPUs or GPUs and even mobile operating system.
        • The portability of the graph allows to preserve the computations for immediate or later use. It can be saved and may be executed in the future.
        • All the computations in the graph are done by connecting tensors together.
        • A tensor has a node and an edge. The node carries the mathematical operation and produces an endpoints outputs.The edges explain the input/output relationships between nodes.

Dinesh K. Vishwakarma, Ph.D.

7

4/29/26

TensorBoard

8 of 27

Why is TensorFlow popular?

    • It is the best library of all because it is built to be accessible for everyone.
    • Tensorflow library incorporates different API to built at scale deep learning architecture like CNN or RNN.
    • It is based on graph computation; it allows the developer to visualize the construction of the neural network with Tensorboad.
    • This tool is helpful to debug the program. Finally, it is built to be deployed at scale. It runs on CPU and GPU.
    • Tensorflow attracts the largest popularity on GitHub compare to the other deep learning framework.

Dinesh K. Vishwakarma, Ph.D.

8

4/29/26

9 of 27

Keras

    • Keras is a high-level neural networks API, written in Python.
    • It is capable of running on top of TensorFlowCNTK, or Theano.
    • Developed for fast experimentation
    • Original authorFrançois Chollet, Google engineer,
    • Stable release2.3.1 / 7 October 2019, Initial release date27 March 2015
    • Written inPython, Keras means: literary image from ancient Greek
    • In 2017, Google's TensorFlow team decided to support Keras in TensorFlow's core library. Keras is an interface rather than a standalone machine learning framework.
    • It offers a higher-level, more intuitive set of abstractions that make it easy to develop deep learning models regardless of the computational backend used.
    • Microsoft added a CNTK backend to Keras as well, available as of CNTK v2.0.
    • Initially, it was developed as part of the research effort of project ONEIROS (Open-ended Neuro-Electronic Intelligent Robot Operating System).

Dinesh K. Vishwakarma, Ph.D.

9

4/29/26

10 of 27

Keras: Features

    • Keras contains numerous implementations of commonly used neural-network building blocks such as layersobjectives, activation functions, optimizers, and a host of tools to make working with image and text data easier to simplify the coding necessary for writing deep neural network code.
    • Keras has support for convolutional and recurrent neural networks. It supports other common utility layers like dropoutbatch normalization, and pooling.
    • Keras allows users to productize deep models on smartphones (iOS and Android), on the web, or on the Java Virtual Machine.
    • It also allows use of distributed training of deep-learning models on clusters of Graphics processing units (GPU) and tensor processing units (TPU) principally in conjunction with CUDA.

Dinesh K. Vishwakarma, Ph.D.

10

4/29/26

11 of 27

Keras: Simplicity

    • TensorFlow

kernel = tf.Variable(tf.truncated_normal([3, 3, 64, 64], type=tf.float32,stddev=1e-1), name='weights')

conv = tf.nn.conv2d(self.conv1_1, kernel, [1, 1, 1, 1], padding='SAME')

biases = tf.Variable(tf.constant(0.0, shape=[64], dtype=tf.float32), trainable=True, name='biases')

out = tf.nn.bias_add(conv, biases)

self.conv1_2 = tf.nn.relu(out, name=’block1_conv2’)

    • Keras:

x = Convolution2D(64, 3, 3, activation='relu', border_mode='same', name='block1_conv2')(x)

Dinesh K. Vishwakarma, Ph.D.

11

4/29/26

12 of 27

Keras: Simplicity

    • Advantages
      • It is fantastic for those who are just getting started in this industry. It makes simple concept prototyping and learning simple.
      • It encourages quick deep neural network testing.
      • It facilitates the creation of clear and concise code.

Dinesh K. Vishwakarma, Ph.D.

12

4/29/26

13 of 27

PyTorch

    • PyTorch is an open source machine learning library based on the Torch library.
    • Used for applications such as computer vision and natural language processing.
    • It is primarily developed by Facebook's AI Research lab. It is free and open-source software released under the Modified BSD license.
    • An open source machine learning framework that accelerates the path from research prototyping to production deployment.
    • Theme “FROM RESEARCH TO PRODUCTION”
    • Original author(s)Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan
    • Initial releaseOctober 2016; 3 years ago
    • Stable release1.4.0 / 15 January 2020; 3 months ago
    • Written inPythonC++CUDA (Compute Unified Device Architecture)
    • PyTorch provides two high-level features:
      • Tensor computing (like NumPy) with strong acceleration via graphics processing units (GPU)
      • Deep neural networks built on a tape-based autodiff system

Dinesh K. Vishwakarma, Ph.D.

13

4/29/26

Used: Facebook and Twitter

14 of 27

PyTorch …

    • Advantages
      • It is excellent for training, building, deploying small projects and prototypes.
      • It is extensively used for Deep Learning applications like natural language processing and computer vision.

Dinesh K. Vishwakarma, Ph.D.

14

4/29/26

15 of 27

Caffe

    • CAFFE (Convolutional Architecture for Fast Feature Embedding) is a deep learning framework, originally developed at University of California, Berkeley, in 2014. https://caffe.berkeleyvision.org/
    • It is open source, under a BSD license (Berkeley Software Distribution).
    • It is written in C++, with a Python interface
    • Original author(s): Yangqing Jia, created during Ph.D.
    • Developer(s): Berkeley AI Research
    • Stable release: 1.0 [1] / 18 April 2017, Caffe 2
    • Supports deep learning architectures such as CNN, RCNN, LSTM and fully connected neural network designs.
    • Caffe also supports GPU- and CPU-based acceleration computational kernel libraries such as NVIDIA cuDNN and Intel MKL.
    • In April 2017, Facebook announced Caffe2, which included new features such as Recurrent Neural Networks. At the end of March 2018, Caffe2 was merged into PyTorch.

Dinesh K. Vishwakarma, Ph.D.

15

4/29/26

16 of 27

Caffe…

    • Why CAFFE?
      • Expressive architecture encourages application and innovation. Models and optimization are defined by configuration without hard-coding. Switch between CPU and GPU by setting a single flag to train on a GPU machine then deploy to commodity clusters or mobile devices.
      • Extensible code fosters active development. The framework tracks the state-of-the-art in both code and models.
      • Speed makes Caffe perfect for research experiments and industry deployment. Caffe can process over 60M images per day with a single NVIDIA K40 GPU*. That’s 1 ms/image for inference and 4 ms/image for learning and more recent library versions and hardware are faster still.
      • Community: Caffe already powers academic research projects, startup prototypes, and even large-scale industrial applications in vision, speech, and multimedia.

Dinesh K. Vishwakarma, Ph.D.

16

4/29/26

17 of 27

Caffe: Features

+Easy to code

+Easy to include different libraries

+Good Python and Matlab interfaces

+Compatible to layer written in Python

+Fastest library on CPU

+Easy to compile and install

+Easy to fine tune

-no auto differentiation

-less suitable for Text, Sound and time series data analysis

Dinesh K. Vishwakarma, Ph.D.

17

4/29/26

18 of 27

MxNet Apache

Dinesh K. Vishwakarma, Ph.D.

18

4/29/26

19 of 27

MxNet Apache…

    • Developer(s): Apache Software Foundation
    • Stable release: 1.6.0 / February 21, 2020
    • Repository: github.com/apache/incubator-mxnet
    • Written: C++, Python, R, Java, Julia, JavaScript, Scala, Go, Perl
    • Features: Apache MXNet is a lean, flexible, and ultra-scalable deep learning framework that supports state-of-the-art in deep learning models, including convolutional neural networks (CNNs) and long short-term memory networks (LSTMs).
    • Supports an efficient deployment of a trained model to low-end devices for inference, such as mobile devices.

Dinesh K. Vishwakarma, Ph.D.

19

4/29/26

20 of 27

Benefit of MxNet

    • Along with quick context change and improved calculation, it supports multiple GPUs.
    • It allows developers to select their preferred programming style for creating deep learning models because it supports both imperative and symbolic programming.

Dinesh K. Vishwakarma, Ph.D.

20

4/29/26

21 of 27

Comparison of Frameworks

    • Number of deep learning frameworks are available to implement, and comparison among all are very tough and even sometime may not fair.
    • Comparison of deep learning models: training time and feature extraction time.

DL Library

K80/CUDA 8/CuDNN 6

P100/CUDA 8/CuDNN 6

148

54

162

69

163

53

152

57

194

76

241

76

269

93

173

57

253

65

145

52

169

51

159

??

205

72

Training Time: CNN (VGG-style, 32bit) on CIFAR-10

DL Library

K80/CUDA 8/CuDNN 6

P100/CUDA 8/CuDNN 6

14.1

7.9

9.3

2.7

8.5

1.6

1.7

21.7

5.9

10.2

2.9

6.5

1.8

7.7

1.6

7.7

1.9

6.3

???

???

???

17

7.4

Avg. Feature Extraction Time: ResNet-50; 1000 Images

Source: https://github.com/ilkarman/DeepLearningFrameworks

22 of 27

Selection of Framework

Dinesh K. Vishwakarma, Ph.D.

22

4/29/26

23 of 27

Selection of Framework…

Dinesh K. Vishwakarma, Ph.D.

23

4/29/26

24 of 27

Good deep learning framework

Dinesh K. Vishwakarma, Ph.D.

24

4/29/26

25 of 27

Conclusion

    • TensorFlow is good for advanced projects, such as creating multilayer neural networks.
      • It’s used in voice/image recognition and text-based apps (like Google Translate) but it struggles with poor results for speed in benchmark tests compared with, for example, CNTK and MXNet.
      • Limitation only fully supported language is Python.
    • Keras is a minimalistic Python-based library that can be run on top of TensorFlow, Theano, or CNTK.
      • Prototyping is really fast and easy
      • It has built-in support for training on multiple GPUs
    • PyTorch is the Python successor of Torch library written in Lua and a big competitor for TensorFlow.
      • PyTorch is mainly used to train deep learning models quickly and effectively.
      • It supports distributed training

Dinesh K. Vishwakarma, Ph.D.

25

4/29/26

26 of 27

References

Dinesh K. Vishwakarma, Ph.D.

26

4/29/26

27 of 27

Thank You�Contact: dinesh@dtu.ac.in �Mobile: +91-9971339840

Dinesh K. Vishwakarma, Ph.D.

27

4/29/26