Think you know everything about PyTorch? Test your skills and deepen your understanding in this comprehensive quiz about one of the most popular deep learning frameworks.
1. Which method is used to set a PyTorch model to evaluation mode?
model.testing_mode()
model.evaluate()
model.eval()
model.training_mode()
2. In PyTorch, how would you move a tensor to the GPU?
torch.cuda(tensor)
tensor.to('cuda')
tensor.cuda()
tensor.gpu()
3. What does torch.nn.functional.relu() do?
Applies the tanh function
Applies the sigmoid function
Applies the rectified linear unit function
Computes the softmax function
4. Which PyTorch class is commonly used to define custom layers in a neural network?
torch.nn.Network
torch.module
torch.nn.Module
torch.nn.Layer
5. What is the key feature of PyTorch's autograd package?
Real-time tensor adjustment
Automatic computation of gradients
Speed enhancement during training
Automatic batch normalization
6. Which of the following is a valid way to create a PyTorch tensor filled with random numbers?
torch.random()
torch.normal()
torch.create_random()
torch.randn()
7. Which is a recommended way of saving a PyTorch model?
torch.serialize(model)
torch.save(model.state_dict())
torch.save(model)
torch.store(model.state())
8. What method should be used to avoid gradient calculations during inference?
torch.no_grad()
torch.stop_grad()
torch.inference_mode()
torch.eval_mode()
9. What is torch.distributed used for in PyTorch?
Parallel and distributed training of models
Performing batch normalization
Managing device memory
Writing custom loss functions
10. Which technique could address NaN values during loss computation?