Maximum (Max)#

API#

class warp_nn.modules.operators.Max(*, requires_grad: bool = True)[source]#

Bases: Module

Element-wise maximum (Max) operation.

This class computes the element-wise maximum of two arrays:

\[\text{Max}(a, b) = \max(a, b)\]

NaN values are propagated, and the gradient is split evenly between the inputs when they are equal (as PyTorch’s maximum does).

Parameters:

requires_grad – Whether the cached output arrays of the module require gradients.

__call__(
a: array,
b: array,
) → array[source]#

Forward pass of the operation.

Parameters:
  • a – The first input array, with up to 3 dimensions.

  • b – The second input array, with the same shape and data type as a.

Returns:

The output array, with same shape as the input arrays.

Raises:
  • ValueError – If the input arrays’ shapes differ.

  • TypeError – If the input arrays’ data types differ, or if their data type or number of dimensions is not supported.