IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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).

Python function

declare

declare()​

max.experimental.custom.declare(name, *, inputs, outputs, parameters=None, custom_extensions=())

source

Declares a custom op from its signature.

Validates the signature, compiles any Mojo source package, and resolves the kernel against custom_extensions once, here, rather than on every call.

Parameters:

Returns:

An immutable CustomOp.

Raises:

  • ValueError – If inputs or outputs is empty, or if neither custom_extensions nor the process-global overlay registers name.
  • TypeError – If a dim names a symbol that is neither a Symbol nor a Param.
  • MojoCompilationError – If a source package fails to compile.

Return type:

CustomOp