Skip to content

Commit

Permalink
change | to Union
Browse files Browse the repository at this point in the history
  • Loading branch information
Chengqian-Zhang committed Dec 13, 2024
1 parent 0608e17 commit 4c2033f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deepmd/dpmodel/output_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __init__(
r_hessian: bool = False,
magnetic: bool = False,
intensive: bool = False,
sub_var_name: list = None,
sub_var_name: list[str] = None,
) -> None:
self.name = name
self.shape = list(shape)
Expand Down
5 changes: 3 additions & 2 deletions deepmd/pt/loss/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import torch
import torch.nn.functional as F
from typing import Union

from deepmd.pt.loss.loss import (
TaskLoss,
Expand All @@ -24,8 +25,8 @@ def __init__(
loss_func: str = "smooth_mae",
metric: list = ["mae"],
beta: float = 1.00,
property_name: str | list = "property",
property_dim: int | list = 1,
property_name: Union[str, list] = "property",
property_dim: Union[int, list] = 1,
**kwargs,
) -> None:
r"""Construct a layer to compute loss on property.
Expand Down
2 changes: 1 addition & 1 deletion deepmd/pt/model/task/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(
bias_atom_p: Optional[torch.Tensor] = None,
intensive: bool = False,
bias_method: str = "normal",
property_name: str | list = "property",
property_name: Union[str, list] = "property",
resnet_dt: bool = True,
numb_fparam: int = 0,
numb_aparam: int = 0,
Expand Down

0 comments on commit 4c2033f

Please sign in to comment.