0Pricing
Mojo Academy · Lesson

Mojo Inside the MAX Graph

Custom ops written in Mojo.

Mojo Inside the MAX Graph is a free Mojo Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Mojo Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Models Are Graphs

Inside MAX, a model is represented as a graph: a network of operations where data flows from one node to the next. 🔗

What an Op Is

Each node in the graph is an op, a single operation like a matrix multiply or an activation function applied to its inputs.

Built-in Ops

MAX ships with many built-in ops covering common layers, so most of a typical model graph works without any extra code.

The Need for Custom Ops

Sometimes your model needs an operation MAX does not include. That is when you write a custom op to fill the gap.

Mojo Powers Custom Ops

You write custom ops in Mojo, giving you systems-level speed for the exact computation your model requires.

An Op Is a Function

A custom op is essentially a Mojo function that takes input tensors and produces an output tensor for the graph.

fn my_op(x: Tensor) -> Tensor:

Speed Where It Counts

Because the op is Mojo, you can use SIMD and other tricks to make that node run as fast as the hardware allows.

Slotting Into the Graph

Once defined, your custom op is registered so MAX can place it in the graph just like any built-in operation.

Optimized Together

MAX still optimizes the full graph, including your custom node, fusing and scheduling work for the best overall throughput.

Best of Both Worlds

This pattern lets you keep a model mostly standard while dropping in a hand-tuned Mojo op exactly where you need speed.

When to Reach for It

Reach for a custom op when a missing or slow node is your bottleneck, not for parts the built-ins already handle well. ✨

Quick Check

Recall how Mojo connects to the MAX computation graph.

Recap

You saw that a MAX model is a graph of ops, and Mojo lets you write fast custom ops that slot right into it. 🎯

Frequently asked questions

Is the “Mojo Inside the MAX Graph” lesson free?

Yes — the full text of “Mojo Inside the MAX Graph” is free to read here on the web, and the Mojo Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Mojo Academy course, upgrade to CoddyKit PRO.

What will I learn in “Mojo Inside the MAX Graph”?

Custom ops written in Mojo. You practise Mojo Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Mojo Academy?

No prior experience is required. Mojo Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Mojo Inside the MAX Graph” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Mojo Academy lesson?

Yes. Every Mojo Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What MAX Provides
  2. Mojo Inside the MAX Graph
  3. Serving a Model with MAX
  4. Where Mojo Meets Production AI
← Back to Mojo Academy