For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo function
elementwise
def elementwise[FuncType: def[width: Int, alignment: Int = Int(1)](Coord[**?]) -> None & RegisterPassable & ImplicitlyCopyable, //, simd_width: Int, *, _trace_description: StaticString = "elementwise"](func: FuncType, shape: Coord[*shape.element_types], context: DeviceContext)
Unified-closure entry point for elementwise (DeviceContext).
Accepts a parametric body (already in
unified-closure form, with explicit captures) and dispatches to
_elementwise_impl. rank and FuncType are inferred from the
runtime shape and func arguments, so simd_width is the only
explicit positional parameter — callers can write
elementwise[N](func, shape, ctx).
Parameters:
- FuncType (
def[width: Int, alignment: Int = Int(1)](Coord[**?]) -> None&RegisterPassable&ImplicitlyCopyable): A parametric callable taking an indexCoordand template parameterswidthandalignment. - simd_width (
Int): The SIMD vector width to use. - _trace_description (
StaticString): Description of the trace.
Args:
- func (
FuncType): The body closure value. - shape (
Coord[*shape.element_types]): The shape of the buffer. - context (
DeviceContext): The device context to use.
Raises:
If the operation fails.