Skip to content

Commit

Permalink
Merge pull request #48 from flatironinstitute/fix-mutable-default-arg
Browse files Browse the repository at this point in the history
FIX avoid side effects from mutable default argument
  • Loading branch information
eickenberg authored Oct 2, 2023
2 parents fb12372 + d9a3305 commit 99f511a
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 99f511a

Please sign in to comment.