Skip to content

Commit

Permalink
multiple namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Nov 25, 2024
1 parent 5fc5379 commit 3c2f31d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions array_api_compat/common/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,13 +938,13 @@ def power(self, y, /, **kwargs):

def min(self, y, /, **kwargs):
self._check_args(**kwargs)
xp = array_namespace(self.x)
xp = array_namespace(self.x, y)
self.x[self.idx] = xp.minimum(self.x[self.idx], y)
return self.x

def max(self, y, /, **kwargs):
self._check_args(**kwargs)
xp = array_namespace(self.x)
xp = array_namespace(self.x, y)
self.x[self.idx] = xp.maximum(self.x[self.idx], y)
return self.x

Expand All @@ -963,14 +963,14 @@ def iwhere(condition, x, y, /):
"""
if is_writeable_array(x):
if is_array_api_obj(y) and len(y.shape) > 0:
xp = array_namespace(x)
xp = array_namespace(x, y)
x, y = xp.broadcast_arrays(x, y)
x[condition] = y[condition]
else:
x[condition] = y
return x
else:
xp = array_namespace(x)
xp = array_namespace(x, y)
return xp.where(condition, x, y)

__all__ = [
Expand Down

0 comments on commit 3c2f31d

Please sign in to comment.