How to use torch.nn.BCEWithLogitsLoss

How should be applied this module considering it combines an activation together with a loss?

The usual pipeline in pytorch is, once you have the model, create a criterion=nn.L1Loss() in example. Later to compute loss = criterion(output,groundtruth) and doing loss.backward()

But how to use it to proper apply the activation and loss?

It’s just a more numerically stable replacement for Sigmoid and BCELoss. Pass in the inputs that you would pass into Sigmoid if you were doing Sigmoid and then BCELoss.