import torch


def recoLossGaussian(predicted_x, x, gaussian_noise_std, data_std):
    """
    Compute reconstruction loss for a Gaussian noise model.
    This is essentially the MSE loss with a factor depending on the standard deviation.
    Parameters
    ----------
    predicted_x: Tensor
        Predicted signal by DivNoising decoder.
    x: Tensor
        Noisy observation image.
    gaussian_noise_std: float
        Standard deviation of Gaussian noise.
    data_std: float
        Standard deviation of training and validation data combined (used for normailzation).
    """
    reconstruction_error = torch.mean((predicted_x - x)**2) / (2.0 * (gaussian_noise_std / data_std)**2)
    return reconstruction_error