I’ve read your loss function
but I can’t see what is the difference except you use torch and F’s operation (like torch.mean(), F.softplus()) at the end of each function
This is code I’m writing
https://github.com/youngminpark2559/test/tree/master/update_CNN

Would you tell me what is the difference?
Generating network
https://github.com/youngminpark2559/test/blob/master/update_CNN/train/train.py#L65

Obtaining prediction
https://github.com/youngminpark2559/test/blob/master/update_CNN/train/train.py#L97

Calculating loss
https://github.com/youngminpark2559/test/blob/master/update_CNN/train/train.py#L102

Updating network
https://github.com/youngminpark2559/test/blob/master/update_CNN/train/train.py#L170