赞
踩
刚开始报错
TypeError: forward() got an unexpected keyword argument 'reduction'
查了半天后发现是写错地方了,原来是这么写的
criterion = nn.CrossEntropyLoss(weight=weights) loss = criterion(x, y, reduction='sum'