【发布时间】:2020-10-23 19:10:57
【问题描述】:
来自 Pytorch documentation,CrossEntropyLoss 将 LogSoftMax 和 NLLLoss 结合在一个类中
但我很好奇;如果我们在分类器中同时使用 CrossEntropyLoss 和 LogSoftMax 会发生什么:
model_x.fc = nn.Sequential (nn.Linear(num_ftrs, 2048, bias=True), nn.ReLU(),
nn.Linear(2048, 1024 ), nn.ReLU(),
nn.Linear(1024 ,256), nn.ReLU(),
nn.Linear(256 ,128), nn.ReLU(),
nn.Linear(128, num_labels),nn.LogSoftmax(dim = 1))
criterion = nn.CrossEntropyLoss()
如果我已经使用上面的代码保存了一个训练好的模型,我如何检查保存的模型使用的标准?
【问题讨论】:
标签: python machine-learning pytorch