Thanks for the code. Unfortunately it’s not executable, but based on the view operation I assume your input has the shape [batch_size, 3, 100, 100].
Based on this shape the output would have the shape [batch_size, 2, 104, 104] and thus the target should have the shape [batch_size, 104, 104] and contain values in [0, 1].
Using these shapes, the script works fine so you could check the shapes of your inputs, outputs, and targets and make sure they have the mentioned shapes.