1 of 28

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 28

Outline

    • Objectives
    • Popular deep learning frameworks
      • TensorFlow
      • Keras
      • PyTorch
      • Caffe
      • Apache MXNet
    • Comparison: training and feature-extraction speed
    • Choosing a framework
    • Conclusion

2

11/13/2026

3 of 28

Objectives

    • Give a simple overview of the main deep learning frameworks, so skills learnt in one carry over to another
    • Show how each framework uses its high-level API to run fast GPU code
    • Compare frameworks fairly: same GPU, CUDA version and precision
    • Compare frameworks across languages (Python, Julia, R)
    • Help you check that your own installation runs as fast as expected
    • Encourage collaboration between open-source communities

3

11/13/2026

4 of 28

Why Do We Need Frameworks?

4

Without a framework

  • Hand-derive every gradient
  • Write GPU (CUDA) code yourself
  • Re-implement layers, optimisers, data loading
  • Easy to make silent mistakes
  • Hard to share or reproduce

With a framework

  • Automatic differentiation (autograd)
  • One line moves computation to GPU/TPU
  • Ready-made layers, losses, optimisers
  • Pre-trained models & datasets
  • Tools for saving, serving and monitoring

→

11/11/2026

5 of 28

Anatomy of a Deep Learning Stack

5

Your model & experiment code

(classifier, detector, language model)

High-level API

Keras · torch.nn · Lightning · Hugging Face

Core framework

Tensors · autograd · graph compiler · optimisers

Math / GPU libraries

CUDA · cuDNN · cuBLAS · XLA · oneDNN

Hardware

CPU · NVIDIA GPU · Google TPU · Apple/AMD accelerators

Higher abstraction

Easier to write, less control

Closer to hardware

Faster, more control

11/11/2026

6 of 28

A Short History of Frameworks

6

2007

Theano

Symbolic graphs, auto-diff (Montréal)

2013

Caffe

Fast CNNs, config files (Berkeley)

2015

TensorFlow 1.x

Keras

Static graphs, sessions (Google)

2016

PyTorch

Dynamic graphs, Pythonic (Facebook/Meta)

2019

TensorFlow 2

Eager mode + Keras built in

2018+

JAX

NumPy + autograd + XLA (Google)

2023

Keras 3

One API on TF, JAX, PyTorch

Trend: from static, hard-to-debug graphs to define-by-run Python code.

11/11/2026

7 of 28

Tensors: The Basic Data Structure

7

Scalar

rank 0-D

3.5

Vector

rank 1-D

[1, 2, 3]

Matrix

rank 2-D

[[1,2],[3,4]]

3-D+ tensor

rank 3-D…

images, video

Every tensor has a shape, a dtype and a device (CPU or GPU).

import torch

x = torch.randn(32, 3, 224, 224) # batch of 32 RGB images

print(x.shape, x.dtype) # torch.Size([32,3,224,224]) float32

x = x.to("cuda") # move to GPU (if available)

y = x.mean(dim=(2, 3)) # shape (32, 3)

Layout conventions

  • PyTorch images: (N, C, H, W)
  • TensorFlow images: (N, H, W, C)
  • N = batch, C = channels

11/11/2026

8 of 28

Introduction

8

11/13/2026

TensorFlow

Google Brain, 2015 (rewritten DistBelief)

Keras

François Chollet, 2015 (now at Google)

PyTorch/Torch

Caffe

Berkeley Vision and Learning Center (BVLC), 2013

Apache MXNet

9 of 28

TensorFlow: Introduction

    • An open-source platform from Google for building, training and running machine learning models. First released in 2015; version 1.0 in 2017.
    • Easy model building
      • The high-level Keras API lets you write a model in a few lines and debug it step by step
    • Run models anywhere
      • Train and deploy in the cloud, on your own servers, in a web browser or on a phone
    • Flexible for research
      • Move quickly from a new idea to a working model and a published result

9

11/13/2026

10 of 28

TensorFlow: Architecture

    • Every TensorFlow project follows three steps:
      • Prepare the data
      • Build the model
      • Train and evaluate the model
    • Tensor: a multi-dimensional array of numbers, such as an image or a batch of text
    • Flow: the tensors pass through a chain of operations, called a graph, and come out as the result
    • That is the name: tensors flowing through a graph of operations

10

11/13/2026

11 of 28

TensorFlow: Graphs

    • TensorFlow records every calculation made during training as a graph
    • Why a graph helps:
      • Runs on many CPUs or GPUs, and even on phones
      • Can be saved and run again later
    • Inside a graph:
      • Nodes are the operations (add, multiply, ...)
      • Edges are the tensors passed between nodes
    • TensorBoard (right) draws this graph so you can inspect it

11

11/13/2026

TensorBoard

12 of 28

Why is TensorFlow popular?

    • Built to be usable by beginners and experts alike
    • Ready-made APIs for large models such as CNNs and RNNs
    • TensorBoard shows the network and its training progress, which makes debugging easier
    • Built for scale: runs on CPUs and GPUs, from a laptop to a data centre
    • One of the most popular deep learning projects on GitHub

12

11/13/2026

13 of 28

Keras

    • A high-level Python API for building neural networks, made for fast experimentation
    • Created by François Chollet (Google engineer); first released in March 2015
    • The name comes from the ancient Greek word for “horn”, a literary image
    • Started as part of the research project ONEIROS
    • Keras is an interface, not a full framework: it runs on top of a backend engine
      • Original backends: TensorFlow, Theano and Microsoft CNTK
      • Since Keras 3 (2023): TensorFlow, JAX or PyTorch
    • Part of TensorFlow’s core library since 2017 (tf.keras)
    • Features:
      • Ready-made layers, loss functions, activations and optimisers, plus image and text tools
      • Supports CNNs and RNNs, plus dropout, batch normalisation and pooling layers
      • Deploy models on iOS and Android phones, on the web or on the Java Virtual Machine
      • Train one model across many GPUs or TPUs at once (distributed training)

13

11/13/2026

14 of 28

Keras: Simplicity

    • TensorFlow

kernel = tf.Variable(tf.truncated_normal([3, 3, 64, 64], dtype=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 (one line):

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

14

11/13/2026

15 of 28

Keras: Advantages and Limits

    • Advantages
      • Ideal for beginners: easy to learn and quick for trying out ideas
      • Lets you test new network designs quickly
      • Code stays short and easy to read
    • Limitation
      • Less control over low-level details than plain TensorFlow or PyTorch

15

11/13/2026

16 of 28

PyTorch

    • Open-source library based on Torch; written in Python, C++ and CUDA
    • Created at Facebook (now Meta) AI Research; first released in October 2016
    • Since 2022 run by the PyTorch Foundation (Linux Foundation); free under a BSD licence
    • Main uses: computer vision and natural language processing
    • Motto: “From research to production”
    • Authors: Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan
    • Two core features:
      • Tensor computing, like NumPy, sped up on GPUs
      • Automatic differentiation (autograd) for training deep networks
    • Advantages:
      • Feels like normal Python: code runs line by line, so it is easy to read and debug
      • Great for building, training and testing prototypes and small projects
      • Widely used for natural language processing and computer vision

16

11/13/2026

Used by: Facebook (Meta) and Twitter

17 of 28

Caffe

    • CAFFE = Convolutional Architecture for Fast Feature Embedding
    • Created by Yangqing Jia during his PhD at UC Berkeley (2013–14); maintained by Berkeley AI Research
    • Written in C++ with a Python interface; open source under a BSD licence
    • Supports CNN, R-CNN, LSTM and fully connected networks
    • Runs on CPU or GPU, using fast libraries such as NVIDIA cuDNN and Intel MKL
    • Last stable release: 1.0 (April 2017)
    • Caffe2 (Facebook, 2017) added recurrent networks and was merged into PyTorch in 2018
    • Why use it:
      • Configure, don’t code: models are defined in config files; one flag switches CPU and GPU
      • Easy to extend: an active community keeps the code and models up to date
      • Fast: over 60M images a day on one NVIDIA K40 GPU (1 ms per image inference, 4 ms training)
      • Proven: used in research, start-ups and industry for vision, speech and multimedia

17

11/13/2026

18 of 28

Caffe: Strengths and Limitations

    • Strengths
      • Easy to code, compile, install and fine-tune
      • Good Python and MATLAB interfaces; accepts layers written in Python
      • Easy to add other libraries
      • One of the fastest libraries on CPU
    • Limitations
      • No automatic differentiation
      • Less suited to text, sound and time-series data

18

11/13/2026

19 of 28

Apache MXNet

    • Open-source framework for training and deploying deep neural networks
    • Scales fast training across many GPUs and many machines
    • Works with many languages: C++, Python, Java, Julia, MATLAB, JavaScript, Go, R, Scala, Perl and Wolfram
    • Amazon chose it as its main deep learning framework on AWS; also offered on Microsoft Azure
    • Backed by Intel, Baidu, Microsoft, Wolfram Research and universities such as CMU, MIT, University of Washington and HKUST
    • Status today: Apache retired MXNet in September 2023, so it is no longer developed

19

11/13/2026

20 of 28

Apache MXNet: Key Facts

    • Developer: Apache Software Foundation
    • Last release series: 1.9; retired in September 2023
    • Code: github.com/apache/incubator-mxnet (now read-only)
    • Written in C++, Python, R, Java, Julia, JavaScript, Scala, Go and Perl
    • Lean, flexible and very scalable; supports CNNs and LSTMs
    • Can deploy trained models to small devices, such as phones

20

11/13/2026

21 of 28

Apache MXNet: Benefits

    • Multi-GPU support
      • Splits work across several GPUs, with fast switching and optimised computation
    • Two coding styles in one framework
      • Imperative: run code step by step, like normal Python
      • Symbolic: define the whole graph first, then run it fast
      • Developers pick the style that suits the task

21

11/13/2026

22 of 28

Comparison of Frameworks

    • Many frameworks exist, so a complete comparison is hard and not always fair.
    • Here we compare two speeds on the same hardware: 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

23 of 28

Choosing a Framework

23

11/13/2026

24 of 28

Choosing a Framework (continued)

24

11/13/2026

25 of 28

Good deep learning framework

25

11/13/2026

26 of 28

Conclusion

    • TensorFlow: strong for large, production-scale projects such as speech, image and text apps (e.g. Google Translate)
      • Slower than CNTK and MXNet in some benchmarks; Python is the main fully supported language
    • Keras: simple Python API for fast prototyping; runs on TensorFlow, JAX or PyTorch
    • PyTorch: Python successor to the Lua-based Torch and TensorFlow’s main rival; trains models quickly and supports distributed training
    • Caffe: fast for image models (CNNs), but weak for text and sequence data
    • MXNet: very scalable across GPUs and languages, but retired in 2023, so avoid it for new work

26

11/13/2026

27 of 28

References

​

27

11/13/2026

28 of 28

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

28

11/13/2026