Skip to content

Commit

Permalink
exclude shared_memory algorithm if uint8 dtype with cval < 0
Browse files Browse the repository at this point in the history
behavior does not match elementwise kernel in this edge case
  • Loading branch information
grlee77 committed Jan 19, 2025
1 parent 0683928 commit af2fce4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/cucim/src/cucim/skimage/_vendored/_ndimage_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,14 @@ def _correlate_or_convolve1d(
default_algorithm = False
if algorithm is None:
default_algorithm = True
if _is_not_windows and input.ndim == 2 and weights.size <= 256:
if (
_is_not_windows
and input.ndim == 2
and weights.size <= 256
and not (
cval < 0 and mode == "constant" and input.dtype.kind == "u"
)
):
algorithm = "shared_memory"
else:
algorithm = "elementwise"
Expand Down

0 comments on commit af2fce4

Please sign in to comment.