Question 1: A network with the type of each layer and the corresponding output shape is given as follows
The input has a shape of 1x32x32. The output shape of each layer is provided as [<ignore>, output channels, height, width]. For instance, at layer βConv2d-1β, the output shape is [6, 28, 28], i.e., six feature maps of spatial size 28×28. Each conv filter and neuron of linear layer has a bias term and stride = 1.
Calculate the number of parameters for each layer and finally the total number of parameters of this network.
Question 2: Define a model in PyTorch with the architecture as given in Question 1. Start with the following constructor
class HelloCNN(nn.Module): def __init__(self):
super(HelloCNN, self).__init__() def forward(self, x):
Question 3: Please answer the following questions:
i) Explain the difference between regression and classification.
ii) You need to train a neural network that predicts the age of a person. Is this a regression or classification problem?
iii) Why do we need a validation set?
Question 4: Let us consider the convolution of single-channel tensors π± β R!Γ! and π° β R#Γ#
β1 0 1 10 10 0 0
πβπ=)β2 0 2./10 10 0 00 β1 0 1 10 10 0 0
10 10 0 0
Perform convolution as matrix multiplication by converting the kernel into sparse Toeplitz circulant matrix. Show your steps.
Question 5: Why might we prefer to minimize the sum of absolute residuals (L1 loss) instead of the residual sum of squares for some data sets (L2 loss)? (Hint: What is one of the flaws of least-squares regression?)




