I want to define a new loss function similar to the one defined in the action recognition using visual attention paper i.e. eq. 7.
I thought it would be useful to use the NLL Loss defined in PyTorch as a guide but I can’t seem to find the source code. What I found on github was this but I do not see its implementation [here] (https://github.com/pytorch/pytorch/blob/master/torch/nn/_functions/thnn/loss.py ).
Would anyone be kind enough to post the link to the source code?
fmassa
(Francisco Massa)
May 23, 2017, 6:38pm
2
Most of the functions are implemented in C / CUDA. For reference, here is the C implementation of NLLLoss
2 Likes
But you don’t have to use that in your custom loss function; you should just implement an nn.Module
with ordinary torch math ops in the forward
method.
2 Likes
RJaikanth
(R Jaikanth)
September 30, 2020, 12:35pm
4
Sorry I am a bit late to the conversation, but will there be any performance issues if we just implement it fully in torch ops?