PANXiao1994 / mRASP2

120 stars 25 forks source link

Where is self.compute_loss( ) defined #5

Closed YePG closed 2 years ago

YePG commented 3 years ago

In the python file label_smoothed_cross_entropy_with_contrastive.py def forward(self, model, sample, reduce=True): net_output = model(**sample["net_input"]) loss, nll_loss = self.compute_loss(model, net_output, sample, reduce=reduce) ....

Where is self.compute_loss( ) defined?

PANXiao1994 commented 3 years ago

https://github.com/pytorch/fairseq/blob/master/fairseq/criterions/label_smoothed_cross_entropy.py#L109