These lines:
       Y_tr = torch.tensor(Y_tr, dtype=torch.long)
       loss = loss_func(output, Y_tr.squeeze(1))

look wrong, as the target would be a LongTensor with a single dimension and wouldn’t fit your use case using nn.BCEWithLogitsLoss, but a multi-class classification using nn.CrossEntropyLoss.
Could you verify that your code is indeed working using the posted code, please?