Quiz Space

Introduction to Deep Learning and Generative AI · Quiz 1 · 26 Oct 2025 · September 2025 term

Question 7: Consider the following PyTorch code that defines a small …

Question 7

+2 marksNumerical answer

Consider the following PyTorch code that defines a small 3-layer fully connected neural network

python
import torch
import torch.nn as nn
class SmallNet(nn.Module):
def __init__(self):
super(SmallNet, self).__init__()
self.fc1 = nn.Linear(4, 6) # input -> hidden1
self.fc2 = nn.Linear(6, 3) # hidden1 -> hidden2
self.fc3 = nn.Linear(3, 2) # hidden2 -> output
def forward(self, x):
x = torch.relu(self.fc1(x))
x = torch.relu(self.fc2(x))
x = self.fc3(x)
return x

How many trainable parameters (weights + biases) does this network have in total?

Show answer

Correct answer: 59

Question 7 of 20 in the IIT Madras BS Introduction to Deep Learning and Generative AI (Deep Learning and GenAI) Quiz 1 paper sat on 26 Oct 2025, in the September 2025 term (IIT M DIPLOMA AN EXAM QDD2 26 Oct 2025). It carries 2 marks.

More questions from this paper

  1. Q1Figure question
  2. Q2You have a tensor x = torch.tensor([1, 2, 3, 4]) with shape (4,). You perform the following operations: What are the sh…
  3. Q3Figure question
  4. Q4You are writing a PyTorch training script on a machine with a CUDA-enabled GPU. You have correctly identified the devic…
  5. Q5Figure question
  6. Q6Figure question
  7. Q8Consider the following code: Removing which of the following layers will make out_train and out_eval identical for the …
  8. Q9If all the weights are initalized to 0 and the input to the network is also a zero vector, then what should be the valu…
  9. Q10Based on the above data, answer the given subquestions.
  10. Q11Select the equation representing the forward pass of the given network:
  11. Q12Figure question
  12. Q13Figure question
  13. Q14Consider the following CNN defined in PyTorch: Based on the above data, answer the given subquestions. How many trainab…
  14. Q15Consider the following CNN defined in PyTorch: Based on the above data, answer the given subquestions. What is the tota…
  15. Q16Consider the following CNN defined in PyTorch: Based on the above data, answer the given subquestions. How many paramet…
  16. Q17Consider the following CNN defined in PyTorch: Based on the above data, answer the given subquestions. What is the tota…
  17. Q18Based on the above data, answer the given subquestions.
  18. Q19Based on the above data, answer the given subquestions.
  19. Q20Based on the above data, answer the given subquestions.