Skip to content

Commit

Permalink
Fix compatibility with numpy 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mdales committed Jan 24, 2025
1 parent 543657d commit c0761ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions yirgacheffe/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,15 @@ def exp2(self):
)

def clip(self, min=None, max=None): # pylint: disable=W0622
# In the numpy 1 API np.clip(array) used a_max, a_min arguments and array.clip() used max and min as arguments
# In numpy 2 they moved so that max and min worked on both, but still support a_max, and a_min on np.clip.
# For now I'm only going to support the newer max/min everywhere notion, but I have to internally call
# a_max, a_min so that yirgacheffe can work on older numpy installs.
return LayerOperation(
self,
np.clip,
min=min,
max=max,
a_min=min,
a_max=max,
)

def numpy_apply(self, func, other=None):
Expand Down

0 comments on commit c0761ca

Please sign in to comment.