Skip to content

Commit

Permalink
FIX avoid side effects from mutable default argument
Browse files Browse the repository at this point in the history
  • Loading branch information
eickenberg authored Sep 29, 2023
1 parent fb12372 commit d9a3305
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pytorch_finufft/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def forward(
output_shape: int,
out: Optional[torch.Tensor] = None,
fftshift: bool = False,
finufftkwargs: dict[str, Union[int, float]] = {},
finufftkwargs: dict[str, Union[int, float]] = None,
) -> torch.Tensor:
"""
Evaluates the Type 1 NUFFT on the inputs.
Expand Down Expand Up @@ -79,6 +79,9 @@ def forward(

err._type1_checks((points,), values, output_shape)

if finufftkwargs is None:
finufftkwargs = dict()

finufftkwargs = {k: v for k, v in finufftkwargs.items()}
_mode_ordering = finufftkwargs.pop("modeord", 1)
_i_sign = finufftkwargs.pop("isign", -1)
Expand Down

0 comments on commit d9a3305

Please sign in to comment.