1. 损失函数概念

损失函数:衡量模型输出与真实标签的差异
深度学习--第12篇: Pytorch损失函数

2. 损失函数

2.1 nn.CrossEntropyLoss

交叉熵损失函数,.
功能:nn.LogSoftmax()与nn.NLLLoss()结合,进行交叉熵计算 数据值进行归一化.
深度学习--第12篇: Pytorch损失函数
深度学习--第12篇: Pytorch损失函数

2.2 nn.NLLLoss

功能: 实现负对数似然函数中的负号功能
深度学习--第12篇: Pytorch损失函数

2.3 nn.BCELoss

二分类交叉熵, 输入取值在[0,1]
深度学习--第12篇: Pytorch损失函数

2.4 nn.BCEWithLogitsLoss

功能: 结合Sigmoid与二分类交叉熵
深度学习--第12篇: Pytorch损失函数

2.5 其他损失函数

深度学习--第12篇: Pytorch损失函数

深度学习--第12篇: Pytorch损失函数
深度学习--第12篇: Pytorch损失函数

相关文章: