All Practice Exams

100+ Free PyTorch Certified Associate Practice Questions

PyTorch Certified Associate (PTCA) practice questions are available now; exam metadata is being verified.

✓ No registration✓ No credit card✓ No hidden fees✓ Start practicing immediately
100+ Questions
100% Free
1 / 100
Question 1
Score: 0/0

What does torch.linspace(0, 1, steps=5) produce?

A
B
C
D
to track
2026 Statistics

Key Facts: PyTorch Certified Associate Exam

~$250

Exam Voucher Value (USD)

Linux Foundation

Linux Foundation

Administering Body

Linux Foundation / PyTorch Foundation

Online proctored

Delivery Format

Linux Foundation

Applied + knowledge

Assessment Type

Linux Foundation

Not published

Question Count and Passing Score

Linux Foundation (not disclosed)

Associate

Certification Level

Linux Foundation

The PyTorch Certified Associate (PTCA) is a Linux Foundation and PyTorch Foundation credential validating foundational PyTorch skills for building, training, and deploying models. It is delivered online with remote proctoring and combines applied tasks with a knowledge assessment, with an exam fee of roughly $250 USD. The exact question count, time limit, and passing score are not published. Core domains are PyTorch fundamentals (tensors, autograd, CUDA), building neural networks (nn.Module, layers, losses, optimizers), data handling (Dataset, DataLoader, transforms), training and evaluation loops, model saving and deployment (state_dict, TorchScript, ONNX), and debugging and best practices.

Sample PyTorch Certified Associate Practice Questions

Try these sample questions to test your PyTorch Certified Associate exam readiness. Each question includes a detailed explanation. Start the interactive quiz above for the full 100+ question experience with AI tutoring.

1In PyTorch, which function creates a tensor filled with zeros of shape (2, 3)?
A.torch.empty(2, 3)
B.torch.ones(2, 3)
C.torch.zeros(2, 3)
D.torch.rand(2, 3)
Explanation: torch.zeros(2, 3) returns a tensor of the given shape with every element initialized to 0. The shape is passed as separate integer arguments or as a tuple/list.
2What attribute must a tensor have set to True for autograd to track operations and compute its gradient during backpropagation?
A.is_leaf
B.requires_grad
C.is_cuda
D.retain_grad
Explanation: Setting requires_grad=True tells autograd to record all operations on the tensor in the computation graph so that calling .backward() can compute gradients with respect to it. Model parameters wrapped in nn.Parameter have this set to True by default.
3Which method moves a tensor x onto a CUDA GPU device in a device-agnostic way that also works on CPU-only machines?
A.x.cuda(force=True)
B.x.gpu()
C.x.device('cuda')
D.x.to(device) where device is set from torch.cuda.is_available()
Explanation: The idiomatic pattern is device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') followed by x = x.to(device). This moves the tensor to the GPU when one is present and stays on CPU otherwise, making the code portable.
4What does calling .backward() on a scalar loss tensor do?
A.It updates the model weights using the optimizer
B.It computes the gradients of the loss with respect to all leaf tensors that have requires_grad=True
C.It zeroes out all previously accumulated gradients
D.It performs the forward pass through the network
Explanation: loss.backward() runs reverse-mode automatic differentiation through the computation graph, populating the .grad attribute of every leaf tensor with requires_grad=True. It computes gradients but does not modify the parameter values.
5Which statement about torch.Tensor.view() versus torch.Tensor.reshape() is correct?
A.view() always copies data while reshape() never copies
B.view() requires the tensor to be contiguous in memory and returns a view sharing storage, while reshape() may return a view or a copy
C.Both always return a copy with independent storage
D.reshape() only works on 1-D tensors
Explanation: view() returns a tensor sharing the same underlying storage and requires the data to be compatible with the requested shape, which typically means contiguous memory. reshape() returns a view when possible but falls back to copying when the layout is not contiguous, so it is more permissive.
6What does tensor.detach() return?
A.A deep copy of the tensor on a new device
B.The gradient of the tensor
C.A new tensor sharing the same data but detached from the computation graph, with requires_grad=False
D.An in-place modified version of the tensor that stops further operations
Explanation: detach() returns a new tensor that shares the same underlying data but is removed from the autograd graph, so it never requires gradients and operations on it are not tracked. It is commonly used to use a value without backpropagating through it.
7By convention, what do PyTorch tensor methods ending in an underscore, such as add_() or relu_(), indicate?
A.They are private internal methods
B.They perform the operation in-place, modifying the tensor directly
C.They always return a tensor on the GPU
D.They are deprecated and should not be used
Explanation: A trailing underscore marks an in-place operation that mutates the calling tensor and returns it, rather than allocating a new tensor. For example, x.add_(1) adds 1 to x directly. In-place ops can save memory but may break autograd if they overwrite values needed for the backward pass.
8Which context manager disables gradient tracking to speed up inference and reduce memory usage?
A.with torch.enable_grad():
B.with torch.autograd.detect_anomaly():
C.with torch.no_grad():
D.with torch.set_grad_enabled(True):
Explanation: with torch.no_grad(): turns off autograd for all operations inside the block, so no computation graph is built. This lowers memory consumption and speeds up forward passes during inference and validation, where gradients are not needed.
9Given a = torch.tensor([1.0, 2.0, 3.0]), what does a.shape return?
A.torch.Size([1, 3])
B.3
C.(3, 1)
D.torch.Size([3])
Explanation: A 1-D tensor with three elements has shape torch.Size([3]), a single-dimension size object. torch.Size is a subclass of tuple, so it can be indexed and unpacked like one.
10Which operation performs matrix multiplication of two 2-D tensors A and B in PyTorch?
A.A * B
B.torch.mul(A, B)
C.torch.matmul(A, B) or A @ B
D.A + B
Explanation: torch.matmul(A, B), equivalently the @ operator, computes matrix multiplication and supports broadcasting for batched tensors. For 2-D inputs the inner dimensions must agree.

About the PyTorch Certified Associate Practice Questions

Verified exam format metadata for PyTorch Certified Associate (PTCA) is pending. The practice questions above remain available while official exam length, timing, passing score, fee, and administrator details are reviewed.