torch / torch7

http://torch.ch
Other
8.97k stars 2.38k forks source link

KL criterion do not understand #1096

Open Lan1991Xu opened 6 years ago

Lan1991Xu commented 6 years ago

HI, Currently, I use KL criterion for my loss function. I do not understand what means in the instruction by" By default, the losses are averaged for each minibatch over observations as well as over dimensions. However, if the field sizeAverage is set to false, the losses are instead summed. " see(https://github.com/torch/nn/blob/master/doc/criterion.md) Does it means the KL also the average of the label dimension? for example, if a=[0.1, 0.2, 0.9;0.2,0.3,0.5] b =[0.2,0.4,0.4;0.5,0.2,0.3] The KL loss will division 2(for the batch size) or division( 2*3(label dimensional))?