You could apply F.sigmoid on your predictions before passing it to the loss function.
However, maybe I misunderstood your use case.
You said you are implementing a multi-class cross entropy. From the shape of your targets it looks like you would like to use a multi-label classification, i.e. each pixel location might have more than one class. Is this right or is every pixel belonging to one class only?