Exercise

Convolution operator - OOP way

Let's kick off this chapter by using convolution operator from the torch.nn package. You are going to create a random tensor which will represent your image and random filters to convolve the image with. Then you'll apply those images.

The torch library and the torch.nn package have already been imported for you.

Instructions

100 XP
  • Create 10 images with shape (1, 28, 28).
  • Build 6 convolutional filters of size (3, 3) with stride set to 1 and padding set to 1.
  • Apply the filters in the image and print the shape of the feature map.