The conv and pooling layers in your model will change the shape of your activations depending on the kernel size, stride etc.
Have a look at CS231n 41 for a detailed description.
The short version:


nn.Conv2d with kernel_size=5 and no padding will subtract 2 pixels on each border (4 pixels in width and height)

F.max_pool2d with kernel_size and stride=2 will divide the spatial size by 2 using the floor operation

Here is a breakdown of your forward method (output shapes as comments):
def forward(self, t):
        t = F.relu(self.conv1(t))  # [N, 6, 28, 28]
        t = F.max_pool2d(t, kernel_size=2, stride=2)  # [N, 6, 14, 14]
        t = F.relu(self.conv2(t))  # [N, 16, 10, 10]
        t = F.max_pool2d(t, kernel_size=2, stride=2)  # [N, 16, 5, 5]
        t = t.view(t.size(0), -1)  # [N, 400]
        t = F.relu(self.fc1(t))
        t = F.relu(self.fc2(t))
        t = self.out(t)
        return t