PyTorch Training Breakdown
- 29Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
29 questions
- 1The function used to create a tensor directly from a Python list is_____.
Hint
Think of the most straightforward creation function that takes a list as input.
Answer
torch.tensor
- 2To create a tensor with all ones of a given shape, use the function_____.
Hint
Consider the function that generates a tensor filled with the number 1.
Answer
torch.ones
- 3The function that creates a tensor with the same shape as a given tensor but filled with random values is_____.
Hint
This function 'mimics' the shape of an existing tensor.
Answer
torch.randn_like
- 4The three critical attributes of a tensor are shape, dtype, and_____.
Hint
This attribute tells you whether the tensor lives on CPU or GPU.
Answer
device
- 5The default data type for tensors that require gradient calculation is_____.
Hint
This is the standard floating-point precision for model parameters.
Answer
float32
- 6To enable gradient tracking for a tensor, set the attribute_____to True.
Hint
This is the 'magic switch' that tells autograd to track operations.
Answer
requires_grad
- 7The attribute on a tensor that points to the function that created it is_____.
Hint
Think of it as a breadcrumb linking to the operation that produced the tensor.
Answer
grad_fn
- 8The method that triggers gradient computation by walking back through the computation graph is_____.
Hint
This single command calculates all gradients for parameters with requires_grad=True.
Answer
loss.backward()
- 9In PyTorch, elementwise multiplication of two tensors is performed with the operator_____.
Hint
This operator matches positions and multiplies them; tensors must have the same shape.
Answer
- 10Matrix multiplication in PyTorch, used for operations like y=xW+b, uses the operator_____.
Hint
This operator follows linear algebra rules: inner dimensions must match.
Answer
@
- 11When using reduction operations like mean along dimension 0, the operation collapses_____.
Hint
Dimension 0 corresponds to the vertical axis in a 2D tensor.
Answer
rows
- 12The function that returns indices of the maximum values along a specified dimension is_____.
Hint
This is commonly used to get a model's predicted class.
Answer
torch.argmax
- 13For custom selection of elements from a tensor using an index tensor, use the function_____.
Hint
This enables dynamic per-row indexing without loops.
Answer
torch.gather
- 14In the forward pass of a linear model, the prediction is computed as y=xW+b, which in code is written as_____.
Hint
Use the matrix multiplication operator and addition.
Answer
x @ W + b
- 15The loss function used for regression tasks that measures the average squared difference between predictions and targets is called_____.
Hint
This loss is also known as L2 loss.
Answer
mean squared error (MSE)
- 16The output of a forward pass, representing the model's initial guess, is denoted by the symbol_____.
Hint
It is written as y-hat in mathematics.
Answer
y^ā
- 17To prevent PyTorch from tracking operations during manual parameter updates, use the context manager_____.
Hint
This tells autograd to ignore the enclosed operations.
Answer
torch.no_grad()
- 18After each training iteration, gradients must be reset to zero using the method_____.
Hint
This method is available on the optimizer or directly on tensors.
Answer
.zero_grad()
- 19To define a custom neural network model in PyTorch, a class must inherit from the base class_____.
Hint
This class provides the structure for all neural network components.
Answer
nn.Module
- 20A pre-built linear layer that performs y=xAT+b is provided by the class_____.
Hint
This layer replaces manual xW+b and manages its own parameters.
Answer
nn.Linear
- 21The activation function that sets all negative inputs to zero is called_____.
Hint
It stands for Rectified Linear Unit.
Answer
ReLU
- 22The activation function that smoothly squashes negative values (used in GPT and LLaMA) is called_____.
Hint
It is a smoother alternative to ReLU, commonly used in transformer models.
Answer
GELU
- 23The activation function that converts raw scores (logits) into probabilities summing to 1 is_____.
Hint
It is typically applied on the output layer for classification.
Answer
Softmax
- 24The layer that maps word IDs to dense vector representations is called_____.
Hint
It acts as a learnable lookup table.
Answer
nn.Embedding
- 25The layer that normalizes inputs by re-centering and re-scaling to mean 0 and standard deviation 1 is_____.
Hint
This stabilizes training in deep networks.
Answer
LayerNorm
- 26During training, the_____layer randomly zeroes out a fraction of neurons to prevent overfitting.
Hint
It is disabled during evaluation by calling .eval().
Answer
Dropout
- 27The optimizer that adjusts learning rates adaptively and is a good default choice is_____.
Hint
It combines momentum and adaptive learning rates.
Answer
Adam
- 28The feed-forward network (FFN) inside a transformer block consists of two linear layers separated by an_____.
Hint
This introduces non-linearity between the linear transformations.
Answer
activation function
- 29The training process for a large language model follows the exact same five-step loop as our toy model; the only differences are scale and_____.
Hint
Think about the specific structure of the model (e.g., transformers vs linear regression).
Answer
architecture

Ask anything
We've read this whole study set, so questions about it get the best answers.