File size: 246 Bytes
079c32c
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import torch
import numpy as np

torch.set_printoptions(precision=6)

times = 6


def mean_relative_error(y_true, y_pred):
    eps = 1e-5
    relative_error = np.average(np.abs(y_true - y_pred) / (y_true + eps), axis=0)
    return relative_error