pytorch loss function 总结
参考原文:https://blog.csdn.net/zhangxb35/article/details/72464152?utm_source=itdadao&utm_medium=referral
nn.L1Loss() #返回差异绝对值
loss(x,y) = 1/n ∑ |xi - yi| n是元素的总个数
shape:
input: (N,) 是任何额外的维度
target: (N,*) same as input
output: scalar ,标量
nnMSELoss() #返回差异的平方,可以去和,求平均数
loss(x,y) =1/n ∑(xi-yi)²
shape:
input: (N,*)
target: (N,*)
output: scalar
nn.CrossEntropyLoss()
单目标二分类或者多分类
loss = -log[ exp(x[class])/ (