- 常用的损失函数
-
平均绝对误差(MAE)
- torch.nn.L1Loss()
-
均方误差(MSE)
- torch.nn.MSELoss()
-
二元交叉熵损失函数
- torch.nn.BCELoss()
-
包含sigmoid层的二元交叉熵损失函数
- loss=torch.nn.BCEWithLogitsLoss()
-
交叉熵损失函数
- torch.nn.CrossEntropyLoss()
- 分开定义softmax运算和交叉熵损失函数可能会造成数值的不稳定,pytorch提供了一个包括softmax运算和交叉熵损失计算的函数,它的数值稳定性更好
- torch.mm(X.view((-1,num_inputs)),W)+b
-
pytorch-常见的损失函数
最新推荐文章于 2024-01-24 10:06:27 发布