pytorch cross entropy loss function of the weight parameters

First, it must also turn Tensor weight of cuda format;

Then, the class_weight as a function of the cross-entropy parameter values ​​corresponding to the input.

class_weight = torch.FloatTensor([0.13859937, 0.5821059, 0.63871904, 2.30220396, 7.1588294, 0]).cuda()

 

Published 38 original articles · 98 won praise · views 360 000 +

Guess you like

Origin blog.csdn.net/xijuezhu8128/article/details/86594621