$25
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 28x28. 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 𝐱∈ℝ!×! and 𝐰∈ℝ#×#
−1
𝒘⋆𝒙=)−2
−1
0
0
0
10
1 10
2./
1 1010
10
10
10
10
0
0
0
0
0 00
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?)