maximum

nvtripy.maximum(lhs: Tensor | Number, rhs: Tensor | Number) Tensor[source]

Performs an elementwise maximum.

Parameters:
  • lhs (Tensor | Number) – The first input tensor.

  • rhs (Tensor | Number) – The second input tensor. It should be broadcast-compatible.

Returns:

A new tensor with the broadcasted shape.

Return type:

Tensor

INPUT REQUIREMENTS:
OUTPUT GUARANTEES:

return[0].dtype == lhs.dtype

Example
1a = tp.Tensor([1.0, 6.0])
2b = tp.Tensor([2.0, 3.0])
3output = tp.maximum(a, b)
Local Variables
>>> a
tensor([1, 6], dtype=float32, loc=cpu:0, shape=(2,))

>>> b
tensor([2, 3], dtype=float32, loc=cpu:0, shape=(2,))

>>> output
tensor([2, 6], dtype=float32, loc=gpu:0, shape=(2,))