Skip to content
ml-recall

#conv2d

4 questions from Convolutional Neural Networks, Attention & Transformers, PyTorch

Timed test

4 questions · 4 min · score and explanations at the end

Take a test
Q 1 / 4Score 0 / 0

Question 1: Short answer

mediumAI-checkedConvolutional Neural Networks

What does this print?

import torch
import torch.nn as nn

cnn = nn.Sequential(
    nn.Conv2d(3, 32, kernel_size=3, stride=2, padding=1), nn.ReLU(),
    nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), nn.ReLU(),
    nn.Conv2d(64, 128, kernel_size=3, stride=2, padding=1))
print(cnn(torch.randn(1, 3, 200, 300)).shape)

Four dimensions in order, e.g. (1, 16, 10, 10)