Skip to content

Instantly share code, notes, and snippets.

@1pha
Last active December 29, 2020 03:14
Show Gist options
  • Save 1pha/b7da9e4c710083f9b8799a2afcebd936 to your computer and use it in GitHub Desktop.
Save 1pha/b7da9e4c710083f9b8799a2afcebd936 to your computer and use it in GitHub Desktop.
RMSE loss for pytorch (from pytorch discussion)
class RMSELoss(nn.Module):
def __init__(self):
super().__init__()
self.mse = nn.MSELoss()
def forward(self, yhat, y):
return torch.sqrt(self.mse(yhat, y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment