Convolutional Layers in PyTorch

Introduction

This is from Udacity's Deep Learning Repository which supports their Deep Learning Nanodegree.

Convolutional Layers in PyTorch

The Convolutional class (Conv2D) is part of the nn module so you have to import that.

import torch.nn as nn

Questions

nn.Conv2d(3, 10, 3)
nn.MaxPool2d(4, 4)
nn.Conv2d(10, 20, 5, padding=2)
nn.MaxPool2d(2,2)

Question 1

After going through the four-layer sequence, what is the depth of the final output?

  • [ ] 1
  • [ ] 3
  • [ ] 10
  • [ ] 20
  • [ ] 40

Question 2

What is the x-y size of the output of the final maxpooling layer?

  • [ ] 8
  • [ ] 15
  • [ ] 16
  • [ ] 30
  • [ ] 32

Question 3

How many parameters, total, will be left after an image passes through all four of the above layers in sequence?

  • [ ] 4 x 4 x 20
  • [ ] 128 x 20
  • [ ] 16 x 16 x 20
  • [ ] 32 x 32 x 20