If you are using reduction='none' (which is the new keyword), the loss won’t be reduced in any dimension:
x = torch.randn(2, 3, 4, 5, requires_grad=True)
y = torch.randn(2, 3, 4, 5)
criterion = nn.BCEWithLogitsLoss(reduction='none')
loss = criterion(x, y)
print(loss.shape)
> torch.Size([2, 3, 4, 5])