Created
May 9, 2018 02:40
-
-
Save jamesr2323/33c67ba5ac29880171b63d2c7f1acdc5 to your computer and use it in GitHub Desktop.
How to use RMSE loss function in PyTorch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Thanks https://discuss.pytorch.org/t/rmse-loss-function/16540 | |
class RMSELoss(torch.nn.Module): | |
def __init__(self): | |
super(RMSELoss,self).__init__() | |
def forward(self,x,y): | |
criterion = nn.MSELoss() | |
loss = torch.sqrt(criterion(x, y)) | |
return loss |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That was incredibly useful thanks !