Contents

pointwiseMax(_:_:)

Computes the element-wise minimum between two tensors.

Declaration

func pointwiseMax(_ lhs: MLTensor, _ rhs: MLTensor) -> MLTensor

Discussion

For example:

let x = MLTensor([1.0, 3.0, 6.0])
let y = MLTensor([6.0, 3.0, 1.0])
let z = pointwiseMax(x, y)
await z.shapedArray(of: Float.self) // is [6.0, 3.0, 6.0]

Shapes must be broadcastable, where the broadcasted shape becomes the shape of the output.

See Also

Model tensor