Now that you localized your distribution for a particular class, the training should be better. It is advisable for the loss to decrease every subsequent epoch (at least for the first few runs). Set a learning rate for which this would happen.

It seems to me that you are computing the loss correctly. The network is a 2 layer MLP. Try playing around with the model architecture, a little more. Add in more layers, preferably Conv1d layers
As for knowing when to stop training, for a particular set of hyperparameters, the training loss would have converged (remains stagnant).
Ideally you should test your trained model on a validation set and choose the model that shows best accuracy on the validation set.

All the best