There are some small differences in your code.
While you are normalizing your input data in the PyTorch code, it looks like you just scale your data in the keras solution to [0, 1]. It shouldn’t make a big difference and normalizing could also work better than just scaling.
You are also missing a dropout layer in your PyTorch code and the loss function is different.
Could you try to use nn.BCEWithLogitsLoss and set the number of output neurons to 1?
Thanks for the response,
I did the changes, but it doesn’t seem to be working. even if the network is not efficient, i expect it should give some decent prediction. I can see only 50% accuracy which no better than random guess.
Could there be some problem with my validation part of the code ?