Title: Quiz 12 — Deep Learning Development Tools (PyTorch)
Course: AIINFRA 100: AI Systems & Development Environments > Section: Week 12 — Deep Learning Tooling: PyTorch

Q: What is a PyTorch tensor most similar to?
- A Python dictionary
- A NumPy array that can also live on a GPU and track gradients
- A CSV file
- A SQL table
A: A NumPy array that can also live on a GPU and track gradients

Q: Installing PyTorch automatically means your code will use a GPU if one is in the computer.
- True
- False
A: False

Q: What does setting requires_grad=True on a tensor do?
- It converts the tensor to a NumPy array
- It makes PyTorch record operations on that tensor into a computation graph for later gradient calculation
- It moves the tensor to the GPU
- It deletes the tensor after use
A: It makes PyTorch record operations on that tensor into a computation graph for later gradient calculation

Q: What PyTorch method computes gradients automatically via the chain rule once you have a loss value?
Feedback: Sample/expected answer: `.backward()`

Q: Which of the following is NOT one of the standard ingredients of a minimal PyTorch neural network?
- A loss function like `nn.MSELoss`
- An optimizer like `torch.optim.SGD` or `Adam`
- A layer such as `nn.Linear`
- A `pandas.DataFrame`
A: A `pandas.DataFrame`

Q: Calling .backward() both computes the gradients and updates the model's weights in a single step.
- True
- False
A: False

Q: What is the classic bug that happens if you forget to call optimizer.zero_grad() before loss.backward()?
Feedback: Sample/expected answer: Gradients silently accumulate (add up) across training steps instead of being freshly calculated each time.

Q: What is the standard order of operations in a PyTorch training loop?
Feedback: Sample/expected answer: forward pass → `loss.backward()` → compute loss