jax.numpy.maximum

Contents

jax.numpy.maximum#

jax.numpy.maximum(x1, x2, /)#

Element-wise maximum of array elements.

LAX-backend implementation of numpy.maximum().

Original docstring below.

Compare two arrays and return a new array containing the element-wise maxima. If one of the elements being compared is a NaN, then that element is returned. If both elements are NaNs then the first is returned. The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.

Parameters:
  • x1 (array_like) – The arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

  • x2 (array_like) – The arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

Returns:

y – The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.

Return type:

ndarray or scalar