Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
remy-abergel committed Nov 22, 2024
1 parent 5aee77b commit 20d17dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

### code

- fixed type inference for `backend.from_numpy()` for torch backend

- fixed typo in function name (read_bruker_best3_dataset instead of
read_bruker_bes3t_dataset), old name was kept available for backward
compatibility
Expand All @@ -15,6 +17,8 @@

### documentation

- fixed bibtex reference [Bar21]

- fixed minor issues in demonstration examples

- fixed pip installation instructions in [README.md](README.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ @article{Barnett_2019
}

@article{Barnett_2021,
title = {Aliasing error of the exp⁡(β1−z2) kernel in the nonuniform fast Fourier transform},
title = {Aliasing error of the exp(β·sqrt(1-z^2)) kernel in the nonuniform fast Fourier transform},
journal = {Applied and Computational Harmonic Analysis},
volume = {51},
pages = {1-16},
Expand Down
12 changes: 8 additions & 4 deletions src/pyepri/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@ def __init__(self, lib, device):
self.erfc = lambda x, out=None : lib.erfc(x, out=out)
self.is_complex = lambda x : x.is_complex()
self.to_numpy = lambda x : x.detach().cpu().numpy()
#self.from_numpy = lambda x : lib.from_numpy(x).to(device, copy=True) # confilct between pytorch and numpy 2.0.0
self.from_numpy = lambda x : lib.Tensor(x).to(device, copy=True)
#self.from_numpy = lambda x : lib.from_numpy(x).to(device, copy=True) # conflict between pytorch and numpy 2.0.0
self.from_numpy = lambda x : lib.Tensor(x).to(device, copy=True, dtype=self.str_to_lib_dtypes[str(x.dtype)]) # need explicit type
self.cast = lambda x, dtype : x.type(self.str_to_lib_dtypes[dtype])
self.transpose = lambda x : x.moveaxis((0,1),(1,0))
self.copy = lambda x : lib.clone(x).detach()
Expand Down Expand Up @@ -782,14 +782,18 @@ def __init__(self, lib, device):
self.is_complex.__doc__ = "return x.is_complex()"
self.to_numpy.__doc__ = "return x.detach().cpu().numpy()"
#self.from_numpy.__doc__ = "return torch.from_numpy(x).to('" + self.device + "', copy=True)"
self.from_numpy.__doc__ = "return torch.Tensor(x).to('" + self.device + "', copy=True)"
self.from_numpy.__doc__ = (
"return torch.Tensor(x).to('" + self.device + "', copy=True, dtype=self.str_to_lib_dtypes[str(x.dtype)])\n"
"where `self` denotes the backends.Backend class instance from wich this lambda\n"
"function belongs to."
)
self.is_backend_compliant.__doc__ = "return all([isinstance(arg, torch.Tensor) for arg in args])"
self.quantile.__doc__ = "return "+ lib.__name__ + ".quantile(u, q, dim=dim, keepdim=keepdim, out=out, interpolation=interpolation)"
self.frombuffer.__doc__ = (
"return " + lib.__name__ + ".frombuffer(buffer, dtype=self.str_to_lib_dtypes[dtype], count=count, offset=offset)\n"
"where `self` denotes the backends.Backend class instance from wich this lambda\n"
"function belongs to."
)
)

# nufft support (use finufft for CPU device and cufinufft
# for GPU device)
Expand Down

0 comments on commit 20d17dc

Please sign in to comment.