tilus.Script.maximum

Contents

tilus.Script.maximum

Script.maximum(lhs, rhs, out=None)[source]

Compute the element-wise maximum.

This instruction computes the element-wise maximum of two register tensors lhs and rhs. The result is a new register tensor with the same dtype.

This instruction supports broadcasting, so if the shapes of lhs and rhs are not the same, they will be broadcasted to a common shape before performing the maximum operation. The broadcasting rules are similar to those in NumPy and PyTorch, where dimensions of size 1 can be expanded to match the other tensor’s shape.

Parameters:
  • lhs (RegisterTensor) – The left-hand side register tensor to compare.

  • rhs (RegisterTensor) – The right-hand side register tensor to compare.

  • out (RegisterTensor, optional) – The register tensor to store the result. If not provided, a new register tensor will be allocated.

Returns:

ret – The register tensor containing the element-wise maximum of lhs and rhs. The shape of the output tensor will be determined by the broadcasting rules applied to lhs and rhs.

Return type:

RegisterTensor