Skip main navigation

New offer! Get 30% off one whole year of Unlimited learning. Subscribe for just £249.99 £174.99. New subscribers only. T&Cs apply

Find out more

Practical: Building a simple CNN

A link to a colab notebook demonstrating how to build simple convolutional neural networks in PyTorch
A schematic of a convolutional neural, showing two convolutional layers, a max pooling layer, and two fully connected layers, one of which is the output layer
© The University of Nottingham
PyTorch does contain some ‘off the shelf’ networks ready for use, but here we will look at how to build a simple convolutional nearal network from scratch.

In the linked Colab notebook we will look at the following:

  • objects and classes
  • the PyTorch module class
  • defining trainable layers, such as convolutional layers
  • adding other layers, such as max pooling layers, and adding activation functions
  • linking layers and activation functions together into a network
  • how to intialise run a forward pass through the network.

Follow the link below and work through the Colab notebook step by step.

A simple CNN in PyTorch

You may wish to open the link in a new browser tab so you can refer back here quickly.

Please leave any questions or comments below.

This article is from the free online

Deep Learning for Bioscientists

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now