Hello,
I have code like this:
loss_fn = reg_BCELoss(dim=2)

loss = 0
def train(...loss_fn):
    ...
    for i_batch, (samples, labels) in enumerate(TrainDL):
        ...
        loss_batch = loss_fn(labels_pred, labels)
        loss += loss_batch.item()
        ...

Now I’d like to set weights inside my training loop but apparently only the constructor can set weights which means, I’d have to create the loss function object inside the loop. Which means, I’d create thousands of objects.
So, what do I do? Do I try to do something stupid?