pymc.math.maximum#

pymc.math.maximum = Elemwise(scalar_op=maximum,inplace_pattern=<frozendict {}>)[source]#

elemwise maximum. See max for the maximum in one tensor

Computes element-wise maximum of two tensors.

Parameters:
xTensorLike

First input tensor

yTensorLike

Second input tensor

Returns:
TensorLike

Output tensor with the maximum of corresponding elements in x and y

Notes

This computes the element-wise maximum, while max(x) computes the maximum value over all elements in a single tensor.

Examples

>>> import pytensor
>>> import pytensor.tensor as pt
>>> a = pt.vector("a")
>>> b = pt.vector("b")
>>> f = pytensor.function([a, b], pt.maximum(a, b))
>>> f([1, 3, 5], [2, 3, 4])
array([2, 3, 5])