nn.CrossEntropyLoss 792 doesn’t take a one-hot vector, it takes class values. You can create a new function that wraps nn.CrossEntropyLoss, in the following manner:
def cross_entropy_one_hot(input, target):
    _, labels = target.max(dim=0)
    return nn.CrossEntropyLoss()(input, labels)

Also I’m not sure I’m understanding what you want. nn.BCELossWithLogits 475 and nn.CrossEntropyLoss are different in the docs; I’m not sure in what situation you would expect the same loss from them.