nn.CrossEntropyLoss is used for a multi-class classification or segmentation using categorical labels.
I’m not completely sure, what use cases Keras’ categorical cross-entropy includes, but based on the name I would assume, it’s the same.
Maybe let’s start from your use case and chose the corresponding loss function, so could you explain a bit what you are working on?