Hi ptrblck! I am trying to use your solution for my unet implementation to compute a weighted loss that emphasizes boundary pixels. However, I do not entirely understand why you need to use logp.gather(1, target.view(batch_size, 1, H, W)). Can you please explain the reasoning behind it?
Cheers!