Skip to content

Commit 474acc6

Browse files
change function name from "expm1_data" to "scale_expm1"
1 parent 6c63cbe commit 474acc6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ppsci/metric/anomaly_coef.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,17 @@ def get_latitude_weight(self, num_lat: int = 720):
8282
weight = weight.reshape((1, 1, -1, 1))
8383
return weight
8484

85-
def expm1_data(self, x: paddle.Tensor):
85+
def scale_expm1(self, x: paddle.Tensor):
8686
return self.scale * paddle.expm1(x)
8787

8888
@paddle.no_grad()
8989
def forward(self, output_dict, label_dict):
9090
metric_dict = {}
9191
for key in label_dict:
9292
output = (
93-
self.expm1_data(output_dict[key]) if self.unlog else output_dict[key]
93+
self.scale_expm1(output_dict[key]) if self.unlog else output_dict[key]
9494
)
95-
label = self.expm1_data(label_dict[key]) if self.unlog else label_dict[key]
95+
label = self.scale_expm1(label_dict[key]) if self.unlog else label_dict[key]
9696

9797
if self.mean is not None:
9898
output = output - self.mean

ppsci/metric/rmse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,17 @@ def get_latitude_weight(self, num_lat: int = 720):
109109
weight = weight.reshape((1, 1, -1, 1))
110110
return weight
111111

112-
def expm1_data(self, x: paddle.Tensor):
112+
def scale_expm1(self, x: paddle.Tensor):
113113
return self.scale * paddle.expm1(x)
114114

115115
@paddle.no_grad()
116116
def forward(self, output_dict, label_dict):
117117
metric_dict = {}
118118
for key in label_dict:
119119
output = (
120-
self.expm1_data(output_dict[key]) if self.unlog else output_dict[key]
120+
self.scale_expm1(output_dict[key]) if self.unlog else output_dict[key]
121121
)
122-
label = self.expm1_data(label_dict[key]) if self.unlog else label_dict[key]
122+
label = self.scale_expm1(label_dict[key]) if self.unlog else label_dict[key]
123123

124124
mse = F.mse_loss(output, label, "none")
125125
rmse = (mse * self.weight).mean(axis=(-1, -2)) ** 0.5

0 commit comments

Comments
 (0)