Source code for pyabsa.networks.losses.RMSELoss

# -*- coding: utf-8 -*-
# file: RMSELoss.py
# time: 2022/11/24 20:10
# author: YANG, HENG <hy345@exeter.ac.uk> (杨恒)
# github: https://github.com/yangheng95
# GScholar: https://scholar.google.com/citations?user=NPq5a_0AAAAJ&hl=en
# ResearchGate: https://www.researchgate.net/profile/Heng-Yang-17/research
# Copyright (C) 2022. All Rights Reserved.
import torch
from torch import nn


[docs] class RMSELoss(nn.Module): def __init__(self): super(RMSELoss, self).__init__()
[docs] def forward(self, y_pred, y_true): return torch.sqrt(nn.MSELoss()(y_pred, y_true))