在研究 Github 的一些示例时,我发现了这个网络(它适用于 FashionMNIST,但并不重要)。
Pytorch forward 方法(关于在 Relu 上应用 Softmax 的大写注释我的查询?):
def forward(self, x):
    # two conv/relu + pool layers
    x = self.pool(F.relu(self.conv1(x)))
    x = self.pool(F.relu(self.conv2(x)))
    # prep for linear layer
    # flatten the inputs into a vector
    x = x.view(x.size(0), -1)
    # DOES IT MAKE SENSE TO APPLY RELU HERE
    **x = F.relu(self.fc1(x))
    # AND THEN Softmax on top of it ?
    x = F.log_softmax(x, dim=1)**
    # final output
    return x