torch nn模块API介绍

阅读 46

2022-03-17

CrossEntropyLoss

类原型:

torch.nn.CrossEntropyLoss(weight=None, 
	size_average=None, 
	ignore_index=- 100, 
	reduce=None, 
	reduction='mean', 
	label_smoothing=0.0
)

这个criterion计算input和target之间的交叉熵损失。

It is useful when training a classification problem with C classes. If provided, the optional argument weight should be a 1D Tensor assigning weight to each of the classes. This is particularly useful when you have an unbalanced training set.

精彩评论(0)

0 0 举报