Implementation details of the loss criterion

I’m trying to read the source code but confused about where the loss criterion is implemented.

For example, it seems to me MSEloss, KLDivLoss etc are implemented in /torch/nn/modules/loss.py
But they are actually empty function ( “pass”)

I also checked /torch/nn/_functions/thnn , but couldn’t find the implementation details there

Thanks!

they are implemented in C here:
https://github.com/pytorch/pytorch/tree/master/torch/lib/THNN/generic

1 Like