Skip to content

Commit

Permalink
fix bug of loss_func
Browse files Browse the repository at this point in the history
  • Loading branch information
Chengqian-Zhang committed Mar 22, 2024
1 parent 09d4de1 commit 1818271
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions deepmd/pt/loss/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,19 @@ def forward(self, input_dict, model, label, natoms, learning_rate, mae=False):
reduction="sum",
beta=self.beta,
)
elif self.func == "mae":
elif self.loss_func == "mae":
loss += F.l1_loss(

Check warning on line 97 in deepmd/pt/loss/property.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/loss/property.py#L96-L97

Added lines #L96 - L97 were not covered by tests
(label["property"] - label_mean) / label_std,
model_pred["property"],
reduction="sum",
)
elif self.func == "mse":
elif self.loss_func == "mse":
loss += F.mse_loss(

Check warning on line 103 in deepmd/pt/loss/property.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/loss/property.py#L102-L103

Added lines #L102 - L103 were not covered by tests
(label["property"] - label_mean) / label_std,
model_pred["property"],
reduction="sum",
)
elif self.func == "rmse":
elif self.loss_func == "rmse":
loss += torch.sqrt(

Check warning on line 109 in deepmd/pt/loss/property.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/loss/property.py#L108-L109

Added lines #L108 - L109 were not covered by tests
F.mse_loss(
(label["property"] - label_mean) / label_std,
Expand Down

0 comments on commit 1818271

Please sign in to comment.