Hey Nay!



 fauxneticien:

I’m guessing since MSE and BCE are instantiated as classes, e.g. MSE = torch.nn.MSELoss(), there are some internals in the object that keep track of the pairwise differences?


Just one clarifying comment on this point:
In general, torch.nn.SomePytorchLoss (the class version) and
torch.nn.functional.some_pytorch_loss() (the function version)
are equivalent.  Instantiating the class version gives an instance of
a function object (that is, an object instance that has a “call” method
(instance.(args ...)) that does essentially the same thing as the
function version.
The class version doesn’t really have any “smart,” loss-specific
internals.  You can typically pass the constructor some “control”
parameters such as class weights or reduction = 'sum'.  These
are stored internally to the specific instance constructed.  But the
instance doesn’t remember anything from call to call about the actual
loss values calculated.
Best.
K. Frank