CrossEntropyLoss takes unnormalized scores (simetimes called “logits”) as inputs.
So if you want x tensor to represent the “perfect predictions”, you would could take the log of what you have (send the 0s to -inf and use 0 (anything finite woudl do) for the 1s).
Best regards
Thomas