<p>This network structure relaced the fully connected layer with global average pooling.
Classical network structure model <a href="https://arxiv.org/abs/1312.4400" rel="nofollow noreferrer">Network in Network</a> use this.</p>
Why doesn't nn.Sequential contain a softmax output layer in the example?
<p>The example from <a href="https://pytorch.org/tutorials/beginner/nn_tutorial.html" rel="nofollow noreferrer">PyTorch's official tutorial</a> has the following ConvNet. My understanding is that the output layer uses a softmax to estimate the digit an image corresponds to. Why doesnt the code have a softmax layer or fully connected layer? </p>

<pre><code>model = nn.Sequential(
    nn.Conv2d(1, 16, kernel_size=3, stride=2, padding=1),
    nn.ReLU(),
    nn.Conv2d(16, 16, kernel_size=3, stride=2, padding=1),
    nn.ReLU(),
    nn.Conv2d(16, 10, kernel_size=3, stride=2, padding=1),
    nn.ReLU(),
    nn.AdaptiveAvgPool2d(1),
    Lambda(lambda x: x.view(x.size(0), -1)),
)

opt = optim.SGD(model.parameters(), lr=lr, momentum=0.9)
</code></pre>