PyTorch MCQ Questions and Answers
Q1. What is a tensor in PyTorch?
A. A multi-dimensional array with additional features for GPU computationsB. A simple Python list
C. A database management system
D. A type of neural network
Q2. Which function is used to convert a numpy array to a PyTorch tensor?
A. torch.array()B. torch.from_numpy()
C. torch.to_tensor()
D. numpy.to_torch()
Q3. What is autograd in PyTorch?
A. Automatic GPU accelerationB. Automatic gradient computation
C. Automatic model training
D. Automatic data loading
Q4. Which PyTorch module is used for creating neural networks?
A. torch.nnB. torch.network
C. torch.neural
D. torch.layers
Q5. What is the purpose of torch.cuda.is_available()?
A. To check if CUDA is installedB. To enable GPU computing
C. To check if a GPU is available for computation
D. To install CUDA drivers
Q6. Which loss function is commonly used for binary classification?
A. MSELossB. CrossEntropyLoss
C. BCELoss
D. L1Loss
Q7. What does torch.no_grad() do?
A. Disables GPU usageB. Disables gradient computation
C. Disables model training
D. Disables data loading
Q8. Which optimizer is NOT available in PyTorch?
A. SGDB. Adam
C. RMSprop
D. QuickProp
Q9. What is the purpose of DataLoader in PyTorch?
A. To load pretrained modelsB. To load data in batches with various options
C. To load model weights
D. To load GPU drivers
Q10. What does requires_grad=True do in PyTorch?
A. Enables GPU accelerationB. Enables gradient computation for the tensor
C. Requires gradual training
D. Requires gradient descent optimizer
Q11. Which method is used to move a tensor to GPU?
A. tensor.gpu()B. tensor.cuda()
C. tensor.to_gpu()
D. tensor.move_gpu()