Converting Keras to Pytorch

Blow is my keras and torch code


Q :
I am wondering why the performance is poor when implementing with torch.

nn.CrossEntropyLoss expects raw logits, so you should remove the softmax at the end of your model.

1 Like

Thanks you very much!