Question 1
What will be the output of the following PyTorch code?
29
43
48
53

The IIT Madras BS Introduction to Deep Learning and Generative AI (Deep Learning and GenAI) Quiz 1 paper sat on 15 Mar 2026, in the January 2026 term, set 2: 24 questions for 52 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
What will be the output of the following PyTorch code?
29
43
48
53
Correct answer
43
Consider the following code snippet:
What will be printed?
torch.Size([5, 1, 3, 1]), torch.Size([5, 3,1])
torch.Size([1, 5, 1, 3, 1]), torch.Size([5, 3,1])
torch.Size([5, 1, 3, 1]), torch.Size([5, 3])
torch.Size([5, 3]), torch.Size([5, 3])
Correct answer
torch.Size([5, 1, 3, 1]), torch.Size([5, 3])
You want to train a linear model using stochastic gradient descent (SGD). Assume that the loss function and training loop are implemented correctly. Which of the following model definitions will result in the weights being updated during training?



Correct answer

Consider the following training loop:
Which statement best describes the problem in this training loop?
The forward pass is missing
Gradients accumulate across epochs, leading to incorrect updates
The optimizer cannot update parameters without model.eval()
The loss function cannot compute gradients
Correct answer
Gradients accumulate across epochs, leading to incorrect updates
You are given a dataset of 10 × 10 grayscale images. Your goal is to build a 5-class classifier. You have to adopt one of the following two options: ● Model A: The input is flattened into a 100-dimensional vector, followed by a fully-connected layer with 5 neurons (without bias). ● Model B: The input is directly given to a convolutional layer with five 10 × 10 filters. (without bias) Suppose you make your choice on the basis of the number of parameters in the models: ● Let = number of parameters in Model A . ● Let = number of parameters in Model B . Which of the following is correct?
p_A > p_B
p_A = p_B
p_A < p_B
Correct answer
p_A = p_B
An image contains 16 channels. Which of the following code snippets correctly creates a convolution layer for this image?
—
—
—
—
Correct answer
—
Consider the following pytorch code to preprocess the FashionMNIST dataset.
Which of the following hold true?
The images in train_dataset will be converted to tensors and normalized before being returned.
The dataset will return normalized images in the range [−1,1] because FashionMNIST is grayscale.
The transforms are automatically applied to the test split while they are not applied to train split.
The dataset will return PIL images and not tensors.
Correct answer
The dataset will return PIL images and not tensors.
An input volume has shape 6x6x2 (height=6, width=6, depth=2 channels). Perform the following two steps on it. ● Step 1: Apply 2x2 Max Pooling with stride=2 ● Step 2: Then, apply 1x1 Convolution with 4 filters. What is the shape of the final output volume?
3x3x2
3x3x4
6x6x4
3x3x8
Correct answer
3x3x4
In an Inception module, four parallel paths produce outputs of shapes: 28x28x64, 28x28x128, 28x28x32, and 28x28x32. After concatenation, what is the output shape?
112×28×128
28×112×256
28×28×256
112×112×256
Correct answer
28×28×256
A CNN produces an output feature map of size 7x7x512, which is followed by Global Average Pooling (GAP) and then a fully connected layer with 10 output classes. Which of the following statements is correct?
GAP converts the feature map into a 49 × 512 vector before classification
GAP produces a 512-dimensional vector, resulting in 5120 trainable parameters in the final layer
GAP produces a 7 × 7 × 1 feature map, followed by a 10-unit fully connected layer
GAP increases the number of parameters compared to flattening
Correct answer
GAP produces a 512-dimensional vector, resulting in 5120 trainable parameters in the final layer
Consider the following code snippet:
What will be printed?
torch.Size([3, 3, 4]), torch.Size([3, 3, 4]), 72
torch.Size([3, 3, 4]), torch.Size([3, 4]), 72
torch.Size([9, 4]), torch.Size([9, 4]), 72
torch.Size([3, 3, 4]), torch.Size([3, 3, 4]), 36
Correct answer
torch.Size([3, 3, 4]), torch.Size([3, 3, 4]), 72
A CNN uses three consecutive 3x3 convolution layers with stride 1 and no pooling. What is the receptive field of a neuron in the third layer?
3x3
5x5
7x7
9x9
Correct answer
7x7
An input feature map of size 32x32 is convolved using SAME padding in the following two independent cases: Case I: ● Filter size: 5x5 ● Stride: 1 Case II: ● Filter size: 3x3 ● Stride: 1 What amount of padding is applied on each side (top, bottom, left, right) in Case I and Case II, respectively?
Case I: 2 pixels, Case II: 1 pixel
Case I: 1 pixel, Case II: 2 pixels
Case I: 2 pixels, Case II: 0 pixels
Case I: 4 pixels, Case II: 2 pixels
Correct answer
Case I: 2 pixels, Case II: 1 pixel
Consider an input image of size 12x12x4. In the convolution layer a single filter of size 12 x 12 is passed to the image. Now consider the image is resized to 14x14x4. How many additional parameters will be added to the convolution layer?
A written answer, not marked automatically.
A hidden layer in the feed_forward network of a CNN contains 5 neurons labelled A,B,C,D,E. We apply dropout to this hidden layer to prevent overfitting. During training the following observations occured - Epoch 1 - B and E were dropped out Epoch 2 - A and D were dropped out Select the false statements :
During epoch 3 of training C will be dropped out
During epoch 4 of training none of the neurons will be dropped out for sure since all of them have been dropped in one of the previous epochs.
During inference all of A,B,C,D and E have equal chances of being dropped out
During inference none of the neurons will be dropped out.
Correct answers
During epoch 3 of training C will be dropped out
During epoch 4 of training none of the neurons will be dropped out for sure since all of them have been dropped in one of the previous epochs.
During inference all of A,B,C,D and E have equal chances of being dropped out
Consider the following CNN :
Calculate the total number of parameters in the CNN.
A written answer, not marked automatically.
Consider the below neural network with fixed weights and answer the given subquestions:
Given the input , what is the output of the network?
0
1
2
2.5
Correct answer
2
Consider the below neural network with fixed weights and answer the given subquestions:
Assume the target value is . Using Mean Squared Error (MSE) as the loss function, compute the numerical value of the loss assuming the input .
A written answer, not marked automatically.
Consider the below neural network with fixed weights and answer the given subquestions:
For which of the following conditions on will the first neuron of the hidden layer not be activated ( )?
—
—
—
—
Correct answer
—
Consider the following fixed neural network implemented in PyTorch.
Loss function used: Based on the above data, answer the given subquestions.
Given the input: What is the output produced by the network?
0.500
0.612
0.648
0.731
Correct answer
0.648
Consider the following fixed neural network implemented in PyTorch.
Loss function used: Based on the above data, answer the given subquestions.
For the input:
The network output is: Recall:
What is the gradient of the loss with respect to the hidden layer activations (i.e. )?
[ 0.334, 0.334]
[ 0.334, -0.334]
[-0.334, 0.334]
[ 0.111, -0.111]
Correct answer
[ 0.334, -0.334]
Consider the following fixed neural network implemented in PyTorch.
Loss function used: Based on the above data, answer the given subquestions.
Based on the hidden-layer weights and the output-layer weights, which of the following statements are correct?
Hidden neuron 0 produces larger activations when .
Hidden neuron 0 produces larger activations when .
Hidden neuron 1 produces larger activations when .
If the predicted class is 1, then the hidden neuron 0 is highly activated.
If the predicted class is 0, then the hidden neuron 0 is highly activated.
If the predicted class is 0, then the hidden neuron 1 is highly activated.
Correct answers
Hidden neuron 0 produces larger activations when .
Hidden neuron 1 produces larger activations when .
If the predicted class is 1, then the hidden neuron 0 is highly activated.
If the predicted class is 0, then the hidden neuron 1 is highly activated.
Consider the below neural network with fixed weights and answer the given subquestions:
A written answer, not marked automatically.
Consider the following fixed neural network implemented in PyTorch.
Loss function used: Based on the above data, answer the given subquestions.
A written answer, not marked automatically.