Skip to main content

function

elementwise

elementwise()

Declares an elementwise operator.

This decorator marks an op as being elementwise. This implies that the op represents a lambda that should be executed in the inner loop of an elementwise function.

For example:

from max.extensibility import Tensor
from max import register

@register.op("mo.add")
@register.elementwise()
fn my_add[
type: DType, rank: Int
](x: Tensor[type, rank], y: Tensor[type, rank]) -> Tensor[type, rank]: