F.cross_entropy expects logits as the inputs and will apply F.log_softmax and F.nll_loss internally on b which is why line1 and line3 are giving equal results.
F.nll_loss expects log probabilities and gives an invalid loss value since you are passing one-hot encoded inputs to it.
nn.BCELoss expects probabilities for both inputs and thus returns a zero loss.