-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev #46
Merged
Dev #46
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
5263466
Wheels for arch64
vovaf709 49746d2
version
vovaf709 cb2204b
Bump `cibuildwheel`
vovaf709 869e3a5
stacklevel
vovaf709 5492cc4
setuptools
vovaf709 97da28f
faster
8d79424
fix
8965b96
Support uint16-32
vovaf709 c5a7bd7
update readme
vovaf709 058acec
version
vovaf709 9a19949
Avoid cropping to float shape/box
vovaf709 c225e32
Merge branch 'master' into dev
vovaf709 fb56fad
style;
vovaf709 644725b
update `setup-python`
vovaf709 086a18b
Support py312
vovaf709 367b898
sdist
vovaf709 8385faf
Fix
vovaf709 f770844
linters
vovaf709 07c457b
flake
vovaf709 bdb4996
Revert "fix"
vovaf709 3b9ee95
Revert "faster"
vovaf709 88d8c45
comments
vovaf709 606e0ff
Bump codecov
vovaf709 0291c18
Add codecov token usage
vovaf709 d9d38be
Bump workflows
vovaf709 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.8.6' | ||
__version__ = '0.8.7' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,7 +137,9 @@ | |
njit_kwargs = {kwarg: getattr(backend, kwarg) for kwarg in backend.__dataclass_fields__.keys()} | ||
self.src_interp1d = njit(**njit_kwargs)(numba_interp1d) | ||
|
||
def __call__(self, x_new: np.ndarray) -> np.ndarray: | ||
def __call__(self, x_new: np.ndarray, use_torch: bool = False) -> np.ndarray: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if use_torch: | ||
import torch | ||
""" | ||
Evaluate the interpolant | ||
|
||
|
@@ -180,14 +182,32 @@ | |
if self.backend.name == 'Numba': | ||
set_num_threads(old_num_threads) | ||
|
||
out = out.astype(max(self.y.dtype, self.x.dtype, x_new.dtype, key=lambda x: x.type(0).itemsize), copy=False) | ||
if use_torch: | ||
out = ( | ||
torch.from_numpy(out) | ||
.to( | ||
max( | ||
torch.from_numpy(self.y).dtype, | ||
torch.from_numpy(self.x).dtype, | ||
torch.from_numpy(x_new).dtype, | ||
key=lambda x: x.itemsize, | ||
) | ||
) | ||
.numpy() | ||
) | ||
else: | ||
out = out.astype(max(self.y.dtype, self.x.dtype, x_new.dtype, key=lambda x: x.type(0).itemsize), copy=False) | ||
|
||
if self.n_dummy: | ||
out = out[(0,) * self.n_dummy] | ||
if self.axis not in (-1, out.ndim - 1): | ||
out = np.swapaxes(out, -1, self.axis) | ||
# FIXME: fix behaviour with np.inf-s | ||
if np.isnan(out).any(): | ||
if use_torch: | ||
have_nan = torch.isnan(torch.from_numpy(out)).any() | ||
else: | ||
have_nan = np.isnan(out).any() | ||
if have_nan: | ||
if not np.isinf(out).any(): | ||
raise RuntimeError("Can't decide how to handle nans in the output.") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mb move this to a function? we're using this logic in several places anyway