Homework 4 - Deep Learning
Enabling GPU
Before running this code on Colab, make sure to go to Edit-> Notebook settings-> GPU to enable GPU.
If device is equal to cuda, it means GPU has been enabled successfully.
In [ ]: import torch
device = torch.device("cuda:0" if torch.cuda. is_available() else "cpu") print (device)
Copying this Colab to your Google Drive
Since we're the author of this Colab, you cannot make any changes to it. You must copy it to your Google Drive by clicking on Copy to Drive. If you don't do this, none of your progress will be saved.
Assignment Introduction
This assignment will give you practice using the library PyTorch, which is a popular library for constructing deep learning models. Deep Learning is a very powerful tool because it is able to learn very complicated functions. Deep Learning has revolutionized fields like image and speech recognition.
The specific task we are trying to solve in this assignment is image classification. We will be using a very commong dataset called CIFAR-10 that has 60,000 images separated into 10 classes. The classes are
airplane
automobile
bird
cat
deer
dog
frog
horse
ship
truck
In this assignment, you will practice:
Reading documentation for a modern machine learning library
Writing PyTorch code.
Evaluating neural network models.
Understand how to improve the performance of an image classification model.
Fill in the cells provided marked TODO with code to answer the questions.
Make sure to restart the kernel and run all cells (especially before turning it in) to make sure your code runs correctly. Note this assignment takes a long time to run so make sure to do this earlier than later.
Unlike other assignments, this assignment will not be autograded. We won't assignment partial credit for each part, so please make sure to check your implementations carefully.