Currently you are passing a one-hot encoded target, which won’t work.
Your target should have the shape [256] and just contain the class indices 0 and 1.
Try to call target = torch.argmax(target, 1) and pass it to your criterion.