From torch.export to the NPU

One operator the accelerator cannot run splits a model in three. Move it to the edge of the graph and you cut the damage about in half.

Learn how a trained model becomes a graph, how a partitioner cuts that graph between the NPU and the CPU, and why every cut costs copies and waiting.

Switch off NPU support for the custom op, then drag it along the graph. Watch the partitions, the copies and the latency bar. Then raise the NPU speed and see what it does not fix. After that we build the whole picture, piece by piece.

You need a rough idea of what a neural network layer is and a little Python. We build the rest from zero.

The numbers in the instrument are an illustrative model, not a measurement. The facts about runtimes come from the primary docs listed in the Field Guide: the ExecuTorch, ONNX Runtime and TensorRT documentation, and the ExecuTorch 1.0 and LiteRT announcements.

Break the graph

4

Illustrative model, not a measurement: seven ordinary ops at 0.10 ms each on the NPU, the custom op at 0.04 ms on the NPU or 1.5 ms on the CPU, a 1 GB/s copy link, and 0.5 ms of waiting per crossing. The tensor sizes are real FP16 sizes for a 224 by 224 image. Chapter 3 derives every term.

Chapter 0

The One Op That Tripled Latency

See how a single operator the accelerator cannot run turns a clean 2 ms model into a 5 ms one, and why a faster chip does not help

A small robot has a camera, a detector network and a board with a neural processing unit (an NPU: a chip that does only the multiply-and-add work of neural networks, and does it very fast). The detector runs in 2 ms. The team is happy.

Then a researcher swaps one activation function for a new one that scored better in training. The model still gives the right answers. But on the robot, each frame now takes almost 5 ms. Nobody changed the NPU. Nobody changed the data. One small operation changed.

This chapter explains why. The answer is not in the math of the new activation. It is in how the model is cut up before it runs.

A model is a graph of operators

A trained network is a list of steps. Each step is an operator (an op): a convolution, an addition, an activation. Each op reads tensors (blocks of numbers) and writes a new tensor. Draw each op as a box and each tensor as an arrow between boxes. You get a graph. The instrument at the top of the page shows a toy one with eight slots.

The NPU does not know every op. Its maker built hardware for the common ones: convolution, matrix multiply, a few activations. If your graph holds an op that is not on the list, the NPU cannot run it. That op is unsupported.

Unsupported ops fall back to the CPU

Something still has to run the unsupported op. The host CPU (the ordinary processor on the board) can run any op, only slower. So the toolchain hands that one op to the CPU. This is called fallback. It keeps the model working, and it is the right default. A model that refuses to load is worse than a slow one.

But fallback has a price that does not show up in the op itself. The NPU and the CPU often have separate memory areas, or at least separate caches and queues. A tensor produced on the NPU must be copied to the CPU side before the CPU can read it. After the CPU finishes, the result must be copied back. Each handover also needs a synchronisation (a sync): the NPU side must wait until the other side signals that it is done.

The toolchain calls each unbroken run of ops on one backend a partition. A fully supported graph is one partition. One unsupported op in the middle gives three: NPU, then CPU, then NPU again. That is two cuts, and every cut costs a copy and a sync.

Watch it happen. The timeline below shows, over time, what each unit is doing for one frame. Choose a case.

Read the frame like a profiler

Three lanes over time. Teal is the NPU working, warm is the CPU working, blue is a copy, yellow is waiting. Switch the case and look for the empty stretches in the NPU lane.

Same illustrative model as the hero. The order of events is what a real profiler shows; the millisecond values are not measured.

In the middle case the NPU works for 0.70 ms and then waits for most of the frame. Look at what it waits for: a copy down, the slow CPU op, a copy up, and two syncs. The NPU is idle while all of that happens. A faster NPU would shrink the teal blocks and leave every other block exactly as long as before.

Why a faster chip does not fix it

Go back to the hero and press NPU 4x with the custom op in slot 4. The baseline falls from 2.04 ms to 1.49 ms. The broken case falls only from 4.90 ms to 4.38 ms. The ratio gets worse: from x2.40 to x2.94. The copies, the syncs and the CPU op did not get faster, so they now make up a bigger share.

This is the fallback cliff. Speed on the accelerator is not the limit. The cost of leaving the accelerator and coming back is the limit.

How to see it on a real system

You do not need to guess. Every toolchain can tell you how it cut your graph. ExecuTorch can print which nodes were delegated to a backend. ONNX Runtime prints the backend it picked for each node when you turn on verbose logging. TensorRT lists each layer with the device it landed on. A profiler such as NVIDIA Nsight Systems shows the same picture as the timeline above: gaps on the accelerator between its busy segments.

The pattern is always the same. First measure how many partitions you have. Then find the op that causes each cut. Then decide: rewrite it, move it, or accept it. The rest of this lesson teaches those three moves, one chapter at a time.

One honest limit before we go on. The numbers in this lesson come from a small model that we wrote, with round values so you can follow the arithmetic. Real boards have different copy speeds and different sync costs. Some share one memory and copy nothing. The shape of the result stays the same: every cut adds fixed costs that a faster chip cannot touch.

A report, read line by line

Here is the kind of summary a toolchain prints. The layout below is made up for teaching, but every real tool shows the same three facts: how many partitions, which backend each one uses, and which ops landed on the CPU.

partition report (illustrative format) P1 NPU ops 1-3 stem, conv A, conv B copy NPU to host 200704 B P2 CPU op 4 custom act copy host to NPU 200704 B P3 NPU ops 5-8 conv D, conv E, conv F, head 3 partitions, 4 copies (plus 2 at the graph edges)

Read it from the bottom. Three partitions means two cuts. The warm line names the op that caused them. The blue lines show what each cut moves. A one-line fix to the activation function is now a clear target, because the report says exactly which op to change.

Who should look at this report? The person who changes the model. The researcher who swapped the activation had no reason to open it, because training does not print one. A good habit is to run the export in the team's test suite and fail the build if the partition count grows. Then a change like this is caught the same day, not on the robot.

Here is what each chapter adds to the instrument.

  1. The deployment path: how a model reaches the partitioner, and where it can break first.
  2. Cutting the graph: the rule a partitioner follows, and why some cuts are forced.
  3. What a boundary costs: the copy and sync terms behind the latency bar.
  4. Runtimes compared: TensorRT, ONNX Runtime, ExecuTorch and LiteRT, and what each ties to the device.
  5. Operator coverage and graph surgery: the slot slider in real life.
  6. Memory planning: how a runtime reserves one block of memory for every tensor.
  7. Quantised graphs: quantise and dequantise nodes around ops that do not support INT8.
  8. Batch 1 and dynamic shapes: why a wide shape range costs speed.
  9. Field Guide: numbers, a checklist, the partitioner as code.
An NPU gets 4 times faster, but a model with one unsupported op in its middle gets only a little faster. Why?

Chapter 1

The Deployment Path

Follow a trained model through six stages to a running binary, and find the stage where an op quietly becomes unsupported

You finish training a model in PyTorch. It is a Python class with weights. Your robot has no Python. It has a board, a small runtime in C++, and an NPU. Between the class and the board sits a pipeline, and the partition cut from Chapter 0 happens in the middle of it.

Knowing the order matters because each stage can change which ops exist. A fix in the wrong stage does nothing.

Stage 1 and 2: capture the graph

A Python class is code, not a graph. Code can have loops and branches that depend on data. The runtime needs a fixed list of ops. So the first job is capture: run the model on an example input and record every op it performs.

PyTorch's tool for this is torch.export. It works ahead of time: it runs once on your computer and produces an ExportedProgram, a graph of ops plus the weights. The ops are ATen ops, the low-level operator set that PyTorch itself is built on. According to the PyTorch tutorial, torch.export does not support graph breaks: if the code needs ordinary Python to decide something from the data, the export stops, and you edit the model. That is a feature. A graph with a hole in it would be worse.

The other common route is ONNX, an open file format for model graphs. Different toolchains read different formats, but the idea is the same: a fixed graph of named ops.

Stage 3: optimise the graph

The captured graph is often wasteful. The toolchain rewrites it with three standard moves. Constant folding computes anything that depends only on fixed numbers, once, ahead of time. Fusion merges neighbours, such as a convolution followed by a normalisation, into one op. Layout changes reorder tensor dimensions, for example from channels-first to channels-last, because the NPU prefers one of them.

Stage 4: partition

Now the partitioner asks a backend: which of these ops can you run? It tags those, and the rest stay with the CPU. Chapter 2 opens this box. In ExecuTorch the backend supplies the partitioner, which tags nodes, and a call named to_backend then lowers each tagged subgraph. Whatever the partitioner leaves untagged runs on a portable CPU implementation, which the ExecuTorch docs say allows partial acceleration but can hurt performance.

Stage 5 and 6: compile, then plan memory and run

Each tagged subgraph is compiled for the backend into a binary blob. In ExecuTorch that blob is stored inside a .pte file. TensorRT chooses a fast kernel (a small program for one op) for each layer and saves an engine plan. At the end, the runtime works out where every tensor lives in memory. Chapter 6 covers that step.

In code, the ExecuTorch route from the official docs is short. The line with partitioner is the one that decides the cut.

pythonfrom torch.export import Dim, export
from executorch.exir import to_edge_transform_and_lower
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner

# 1. capture: a graph of ATen ops plus weights (ahead of time)
exported = export(model, inputs, dynamic_shapes=dynamic_shapes)

# 2. partition + compile: ops XnnpackPartitioner tags go to XNNPACK,
#    the rest stay on the portable CPU path
program = to_edge_transform_and_lower(
    exported, partitioner=[XnnpackPartitioner()]
).to_executorch()

# 3. one file for the device
with open("model.pte", "wb") as f:
    f.write(program.buffer)

The partitioner argument takes a list. You can give several in priority order, so an op the first backend cannot run can go to the next. The docs name this exact use: ops unsupported on a GPU can fall back to the CPU through XNNPACK.

Walk the pipeline

Pick a stage to see what goes in, what comes out and what can break. Then switch on version drift and watch which stage first shows the damage.

The dots reuse the eight-slot toy graph. The stage notes follow the PyTorch export tutorial and the ExecuTorch export documentation; the partition counts come from the illustrative model.

A worked fusion: folding a normalisation into a convolution

Stage 3 sounds abstract, so here is one real rewrite with numbers. A batch normalisation layer after a convolution computes y = γ (x − μ) / √(σ² + ε) + β. At inference time γ, μ, σ², ε and β are all fixed numbers. So the optimiser can fold them into the convolution's own weights and bias, and the normalisation op disappears.

Take γ = 1.5, σ² = 0.24, ε = 0.01, μ = 0.05, β = 0.1. The square root of 0.24 + 0.01 = 0.25 is 0.5, so the scale factor is 1.5 / 0.5 = 3. A convolution weight of 0.2 becomes 0.2 × 3 = 0.6. A convolution bias of 0 becomes 0.1 + (0 − 0.05) × 3 = −0.05. The graph now has one op where it had two, and the answers are the same.

This matters for partitioning in both directions. Fusion removes ops, so there are fewer places for a cut. But a fusion pass can also produce a fused op that your backend has never heard of. Always compare the report before and after the optimiser runs.

Why versions matter

Support for an op is a fact about a pair: this toolchain version and this backend version. Change either and the fact can change. The ONNX Runtime quantisation page gives a real case: 8-bit support for some operators "was added in ONNX opset 12", so a model exported with an older opset leaves those ops out of the quantised path and the page tells you to upgrade the model. Runtimes move too. ExecuTorch reached 1.0 general availability on 22 October 2025, after a beta in October 2024. TensorFlow Lite was renamed LiteRT on 4 September 2024; the announcement says the .tflite file format did not change.

So the failure mode here is not a crash. After an upgrade, the model still loads and still gives right answers. A supported op became unsupported, the partitioner added a cut, and latency jumped. That is Chapter 0 again, with a different cause.

After a toolchain upgrade, a model gives the same answers but runs twice as slow. What is the most likely cause?

Chapter 2

Cutting the Graph

Learn the one rule a partitioner follows, count partitions with a simple formula, and see why some cuts are forced by the graph itself

Picture a freight yard. A long train of cars must go to a fast depot, but the depot refuses cars that carry one odd cargo. Every time an odd car appears, the yard crew must uncouple the train, take the odd car to a slow siding, bring it back and couple the train again. Two uncouplings per odd car. The depot is quick. The crew is not.

A partitioner is that yard crew. It is a piece of the toolchain that decides which ops go to which backend. Its rule is simple: group neighbouring ops that one backend can run into one block.

The rule, in plain steps

  1. Ask the backend. For each op, the backend answers yes (I can run this) or no.
  2. Walk the graph in order. Start with an empty block.
  3. Grow the block. If the next op is a yes and joining keeps the graph runnable (more below), add it.
  4. Close the block at the first no. The no-op goes to the next backend on the list, usually the CPU.
  5. Start a new block after the no-op, and repeat.

Real toolchains name the steps differently, but they all follow this shape. In ONNX Runtime, the execution providers form an ordered list. The documentation says a node runs on the first provider that is capable and otherwise falls to the next, with the CPU provider last. Each provider reports what it can take through a function called GetCapability(). In ExecuTorch, the backend's partitioner tags the nodes it wants. The tag is stored on the node as delegation_tag, and to_backend lowers every tagged group. The ONNX Runtime TensorRT provider says it will "partition the graph and only send supported subgraphs to TensorRT".

Counting partitions

Take a chain of ops where every unsupported op sits alone in the interior. Each such op splits the NPU work in two. So with k unsupported interior ops there are k + 1 NPU partitions and k CPU partitions.

Now count the copies. The graph input starts in host memory and the answer must end there. So every NPU partition needs one copy in and one copy out. That gives a clean formula: copies = 2 x NPU partitions.

copies
The number of times a tensor crosses between host memory and NPU memory in one frame. Each crossing also needs a sync.
Pnpu
The number of separate NPU partitions in the cut graph.
k
The number of unsupported ops, each sitting alone in the interior of the graph, with supported ops on both sides.

Check it against the hero. One unsupported op in slot 4: k = 1, so 2 NPU partitions and 4 copies. The hero shows 3 partitions and 4 copies in total, because the CPU block counts as the third. Put the op in slot 1 or slot 8: the NPU is left with one block, so it needs only 2 copies. That is the whole reason the edge is cheaper.

Now the bad case. Suppose 12 unsupported ops are scattered through a graph with supported ops between them. That gives 13 NPU partitions and 26 copies. At 0.5 ms of waiting per crossing, as in our toy model, the waiting alone is 13 ms. The graph would run faster on the CPU alone. Real partitioners guard against this: some let you set a minimum size for a block, so a tiny block is not sent to the accelerator.

A cut the graph forces

Step 3 hid a condition: joining must keep the graph runnable. Real graphs are not chains. They have branches. Take four ops: a feeds both b and c, and both feed e. Say a, b and e are supported and c is not. It is tempting to put a, b and e in one NPU block and send c to the CPU.

That cannot work. The block needs c's result before it can run e. But c needs a's result, and a is inside the same block. The block would have to start, pause, wait for c, and then continue. Blocks are run as single units, so this is a cycle: block to c to block. A legal partitioner must refuse the merge and cut into three: {a, b}, then {c}, then {e}.

Cut a diamond

Ops a, b and e run on the NPU. Op c cannot. Try the greedy merge first, then the cycle-safe cut.

A four-op teaching graph. The cycle rule is the standard condition for grouping ops in a directed graph; real partitioners such as ONNX Runtime's GetCapability must obey it too.

The cut costs something: with the safe cut, 2 NPU blocks and 4 copies. The graph forced the cost, not the partitioner. This is why you cannot always fix a bad cut by tuning the partitioner. Sometimes you must change the graph, and Chapter 5 shows how.

A chain has 3 unsupported ops, each alone in the interior with supported ops on both sides. How many NPU partitions and how many copies?

Chapter 3

What a Boundary Costs

Add up the four terms behind the latency bar, work one example to the last digit, and see why the edge of the graph is cheaper than its middle

You are shipping a parcel across town by courier. The drive is short. But each pickup needs a signature, and each drop needs another. If you send one parcel in two trips, you do not pay double for the road. You pay double for the signatures.

A partition boundary works the same way. The road is the copy: moving the bytes of a tensor from one memory to another. The signature is the sync: a fixed wait while the driver flushes queues and one side tells the other it may go. The copy depends on how big the tensor is. The sync does not.

Four terms

Latency for one frame is the sum of four things. The NPU works. The CPU works on its fallback ops. Bytes cross the link. And someone waits at each crossing.

T
Time for one frame, from the image arriving to the answer being ready, in ms.
Tnpu
Time the NPU spends computing, summed over its ops.
Tcpu
Time the CPU spends on the fallback ops.
B
Bytes in the tensor that crosses. FP16 uses 2 bytes per number.
BW
Bandwidth of the copy path. In the toy model, 1 GB/s, which is 1,000,000 bytes per ms.
tsync
Fixed wait per crossing. In the toy model, 0.5 ms.

The tensor sizes are real

A tensor of shape 64 x 56 x 56 in FP16 holds 64 x 56 x 56 = 200,704 numbers, at 2 bytes each: 401,408 bytes. The input image, 3 x 224 x 224 in FP16, is 301,056 bytes. After the network has downsampled to 512 x 7 x 7, the tensor is 50,176 bytes. The final 1,000 class scores are 2,000 bytes. A backbone gets smaller toward its end, and that matters in a moment.

Worked example, to the last digit

Here are all four terms for the hero graph with the custom op in slot 4. Seven ops stay on the NPU at 0.10 ms each, so Tnpu = 0.70 ms. The custom op runs on the CPU: Tcpu = 1.50 ms.

Now the four crossings.

  1. Image up to the NPU: 301,056 bytes, 0.301 ms to copy.
  2. Slot 3's result down to the CPU: 200,704 bytes, 0.201 ms.
  3. Slot 4's result up again: 200,704 bytes, 0.201 ms.
  4. Scores down to the host: 2,000 bytes, 0.002 ms.

copies = 0.301 + 0.201 + 0.201 + 0.002 = 0.704 ms   syncs = 4 × 0.5 = 2.000 ms

T = 0.700 + 1.500 + 0.704 + 2.000 = 4.904 ms

The all-NPU baseline has two crossings: 0.301 + 0.002 = 0.303 ms of copies, 1.0 ms of syncs, 0.74 ms of compute (the custom op takes 0.04 ms on the NPU). Its total is 2.043 ms. So the broken graph is 4.904 / 2.043 = x2.40.

Now put the op in slot 8 instead. The CPU still pays 1.50 ms. The crossings are the image up (0.301 ms) and slot 7's smaller result down (50,176 bytes, 0.050 ms). Copies: 0.351 ms. Syncs: 2 x 0.5 = 1.0 ms. Total: 0.70 + 1.50 + 0.351 + 1.0 = 3.551 ms, which is x1.74.

Compare the damage, which is the time added over the baseline. In the middle, 4.904 − 2.043 = 2.861 ms. At the edge, 3.551 − 2.043 = 1.508 ms. The edge costs 53% of the middle. Moving the op did not make the op itself any faster. It removed two crossings.

Price every slot

One bar per position of the unsupported op. Drag the sync wait and the copy bandwidth. Find the slots where the bars are shortest.

0.5 ms
1 GB/s

Illustrative model with the hero's constants. Set the wait to 0 and the bandwidth to 8 GB/s to approximate a board with shared memory and cheap handover: the cliff shrinks, and the CPU op remains.

Two things stand out. The middle slots all land between 4.65 and 5.31 ms, because the sync term does not care where the cut falls and only the copy size changes. And the two edges are far cheaper. Slot 8 beats slot 1 slightly, because the tensor leaving the end of the network (50 KB) is smaller than the one leaving the start (401 KB).

Why the edge trick is mostly about waiting

Drag the wait slider in the device to 0 and look again. The baseline falls to 1.043 ms. The middle case becomes 2.904 ms and the last-slot case 2.551 ms. The damage is now 1.861 ms in the middle and 1.508 ms at the edge: the edge costs 81% of the middle, not 53%. The copies are nearly the same in both cases once waiting is gone, and the CPU op costs the same everywhere. So most of the edge's advantage comes from the waits it avoids.

That tells you where to push on a real board. Some boards let the CPU and the accelerator read the same memory. There the copy can shrink or vanish, but the hand-over still needs a signal, so a wait remains. Cutting the number of crossings helps on every board. Speeding up the link helps on some.

Failure mode: symptom, measurement, fix

Symptom: the NPU is rated for far more than you see, and frame time barely moves when you upgrade it. Measurement: count the crossings in the partition report and multiply by your per-crossing cost. Or open a profiler trace and look for gaps on the accelerator lane between busy segments. Fix: remove crossings first (rewrite, move, or fuse the unsupported op out of the middle). Then shrink what remains: on boards with memory shared between the CPU and the accelerator, pass buffers by reference instead of copying them.

On real hardware: on an NVIDIA Jetson Orin Nano developer kit, run your model with trtexec in verbose mode, then record a trace with Nsight Systems. Count the gaps between accelerator segments and compare their total with your model's compute time. Check the options for your TensorRT version with trtexec --help.

The unsupported op moves from slot 4 to the last slot. What changes in the latency formula?

Chapter 4

Runtimes Compared

Compare four runtimes by what they compile, where unsupported ops go, and what ties the finished artefact to one device or one version

You tested your model on a laptop with one NVIDIA GPU and it ran fast. You copy the compiled file to the robot, which has a different GPU. The program crashes while loading. Or worse, it starts, and for half a minute nothing happens.

The cause is the same idea in every runtime: the compiled file is not the model. It is the model after choices were made for one device and one toolchain version. This chapter compares four runtimes on that idea.

A runtime is the program on the device that loads a compiled model and runs it. Chapter 1 followed the build path. Here we look at what each runtime does with the partition cut, because the answer decides what you ship.

Four ways to cut and compile

RuntimeWho gets a nodeUnsupported ops go toWhat the artefact is tied to
TensorRTLayers run on the GPU or on a DLA (a fixed-function deep learning engine on some Jetson boards)GPU fallback where enabled; the DLA page notes platforms with no GPU fallback, where every layer must be DLA-capableThe device type and the TensorRT version that built the engine
ONNX RuntimeAn ordered list of execution providers; each reports what it can take with GetCapability()The next provider in the list; the CPU provider lastDepends on the provider; the TensorRT provider caches engines that are not portable
ExecuTorchA partitioner per backend tags nodes; to_backend lowers each tagged groupThe next partitioner in the list, then a portable CPU pathThe .pte file holds backend blobs built for that backend and version
LiteRTDelegates hand parts of the model to accelerators such as GPUs and DSPsThe CPU; a delegate that rejects the model's data type leaves the whole model on the CPUThe .tflite format did not change at the rename from TensorFlow Lite

Three of the four share one pattern: an ordered list of backends, and the CPU as the last stop. That makes the partition report the right first tool in every one of them. The fourth, TensorRT, builds its own engine, and its engine is the strictest about where it can run.

Where ExecuTorch stands

The ExecuTorch 1.0 announcement lists which backends reached production-ready status: XNNPACK for the CPU, Core ML for Apple silicon, the Qualcomm AI Engine delegate for the Hexagon NPU, Arm Ethos-U, and Vulkan for GPUs. New in 1.0 were Arm VGF, the NXP eIQ Neutron NPU, Samsung Exynos NPU and GPU, and OpenVINO. Meta's Reality Labs says it uses ExecuTorch in production in its wearables, including the Meta Ray-Ban Display glasses. One cost is worth knowing: the docs note that native developer tools cannot see inside delegated code, so you debug with debug handles.

For LiteRT, the current docs list two ways to run a model: the Interpreter API, with GPU and NPU delegate pages, and the CompiledModel API, which the docs label as accelerated on GPU and NPU on Android. Check which one your target board supports.

How to choose

Start from the hardware, not the library. Each accelerator maker supports a few runtimes well. The ExecuTorch list above shows the vendor delegates that its team calls production-ready. TensorRT is NVIDIA's own path. For a board where several are possible, export once, run the partition report in each, and pick the one with the fewest partitions at the latency you need. A runtime that loads your model but cuts it into twelve pieces is a worse choice than one that needs a small rewrite and gives you one.

Also check how you will debug. The ExecuTorch docs note that native developer tools cannot see inside delegated code. That is true of any compiled blob. Plan time for it: keep a reference run on the CPU and compare outputs.

A TensorRT engine is a build artefact

TensorRT tries many ways to run each layer and keeps the fastest. Each way is a tactic (a particular kernel and settings). This search takes time, so the result is saved as an engine (also called a plan). The ONNX Runtime documentation warns that the first run "can be very long because building engine involves exhaustive profiling", and that the engine and profile files "are not portable and optimized for specific Nvidia hardware".

The TensorRT documentation spells out the rules. By default an engine works only with the TensorRT version that built it, and only with the type of device where it was built. If they do not match, "the plan will fail to deserialize". You can build in two relaxed modes. A version-compatible engine can load on later runtimes, but it "can be slower". A hardware-compatible engine can target all Ampere and newer GPUs, or GPUs of the same compute capability, but it leaves out tactics that are not portable, so it "can have lower throughput and/or higher latency". The docs also say hardware compatibility is not supported on JetPack, so on a Jetson board build the engine on the board itself. Try the combinations.

Move the engine

The engine was built on one GPU with one TensorRT version. Choose where it goes and how it was built.

The rules follow the TensorRT engine compatibility documentation: defaults need the same device type and the same TensorRT version; the two build modes relax one of them each and can cost speed. Real behaviour depends on your versions, so test the exact pair you ship.

The fix: build where it runs, then cache

Symptom: a crash at load, or a long pause at start-up. Measurement: time the first model load on a clean device, then the second. A large gap means an engine was built at load. Fix: either ship one engine per device type and version, or build on first boot and keep the result in a cache. ONNX Runtime's TensorRT provider has an option named trt_engine_cache_enable for this, and its documentation says the purpose is "to save engine build time".

For a robot this matters at the worst moment: a field update changes the TensorRT version, and the robot spends minutes rebuilding while it is supposed to be driving. Build the new engine before the switch, and keep the old one until the new one passes a smoke test.

On real hardware: on a Jetson Orin Nano developer kit, build an engine with trtexec, time the build, then load the saved plan and time the load. Then copy the plan to a machine with a different TensorRT version and note the error text.

You update the TensorRT version on a robot fleet and the first boot takes minutes. What happened, and what is the standard fix?

Chapter 5

Operator Coverage and Graph Surgery

Fix a bad cut by rewriting the op into supported pieces, moving it to the edge, or keeping its shape fixed, and compare the price of each fix

The partition report says it plainly: one op, GELU with a custom kernel, runs on the CPU. The model needs it. The NPU does not list it. You have three tools and a fourth that you should avoid until the others fail.

We call this work graph surgery: you change the graph, not the model's meaning, so the partitioner can cut it better.

Tool 1: rewrite the op into supported primitives

Most unsupported ops are made of simple parts. A primitive is an op the NPU already knows: add, multiply, tanh. If you write the unsupported op as a chain of primitives, the NPU can run the chain. The partitioner then sees no unsupported op at all.

Here is a real example. The exact GELU activation is x · Φ(x), where Φ is the normal curve's cumulative probability. A common form needs the error function, erf, which many NPUs lack. The well-known tanh form uses only primitives:

GELU(x)
The activation output for input x. Small negative inputs give small negative outputs; large positive inputs pass through.
√(2/π)
A constant, about 0.79788. The toolchain folds it into one multiply.
0.044715
A fitted constant that makes the tanh curve hug the exact curve.

Count the primitives: x times x, times x again, times 0.044715, plus x, times 0.79788, tanh, plus 1, times x, times 0.5. That is 9 ops, all of them elementwise. We checked the error numerically. Over inputs from −6 to 6 the largest gap from the exact GELU is 0.00047, near x = 2.70. At x = 1 the exact value is 0.84134 and the tanh form gives 0.84119.

That gap is small, but it is not zero. So the rewrite changes the model's numbers slightly. You must re-check accuracy on real data after the swap. And the NPU now runs 9 ops where it ran 1 custom op. In our toy model that costs 0.15 ms of NPU time, instead of 0.04 ms (illustrative: real fusion may shrink it).

Tool 2: move the op to the edge

Some ops belong at the edge anyway. Resizing and normalising the image come before the network. Softmax, argmax and box decoding come after it. If you leave them in the exported graph and they are unsupported, they sit at an edge already, and the cost is one cut and no extra round trip. If you leave a final softmax in the graph and it is the only unsupported op, export the model without it and run it in your own code on the CPU. The tensor there is tiny: 2,000 bytes for 1,000 scores.

You cannot slide a mid-network op to the end without changing the math. Moving works only for ops whose order the model does not care about. When it works, it works well. In our model it cuts the damage from 2.86 ms to 1.51 ms.

Tool 3: keep shapes fixed

Some ops end up on the CPU not because of their name but because of their shape. An op whose output size depends on the data (for example, "keep only the boxes above a threshold") produces a tensor whose size is unknown until it runs. A static NPU plan cannot reserve memory for that. If a control loop needs the same answer shape every frame, fix the shape: pad to a maximum count and carry a mask. The graph becomes static and the cut disappears.

Tool 4: a custom op or plugin

If nothing else works, you write the op yourself in the backend's own language. This is the last resort: it is code you now maintain, tied to one backend and version. A later lesson in this track, on custom operators and plugins, covers how.

Operate on the graph

The custom activation sits in slot 4. Choose a fix and look at the partitions and the latency. Then set the NPU speed to 4x.

Illustrative model. Rewrite: the op runs on the NPU at 0.15 ms. Plugin: the op runs on the NPU path at 0.06 ms, but costs engineering and ties you to one backend version. The 4-tool choice is a design rule of thumb, not a measurement.

Set the NPU to 4x and compare. The rewrite and the plugin remove every cut and land near x1.02 and x1.00. Moving to the edge gives x2.03. Leaving the op gives x2.94. The faster the NPU, the more the cuts weigh. The plugin is only slightly ahead of the rewrite, and it is far more work to keep.

Choosing between the tools

Try them in the order of the list. A rewrite changes numbers a little but keeps the model on one partition. A move changes nothing in the model but keeps one cut. Fixed shapes cost a mask or some padding. A plugin costs you code to maintain for as long as you ship. Write down which tool you picked and why, next to the model. The person who upgrades the toolchain next year will need it.

Failure mode. Symptom: after the rewrite, latency drops but accuracy slips by a hair on some inputs. Measurement: run both versions on a few thousand real frames and compare outputs. Fix: if the gap matters, retrain or fine-tune with the new form, so the model learns to use the approximation.

On real hardware: on a Jetson Orin Nano developer kit, build the model twice with trtexec in verbose mode, once with the original op and once with the rewrite. Compare the layer lists for which device each layer landed on, and compare the measured latencies.

Which fix removes the most cuts for an unsupported activation in the middle of a network?

Chapter 6

Memory Planning: Arenas and Lifetimes

Place every tensor of the model in one block of memory ahead of time, and see why the block needs far less than the sum of the tensors

Think of a parking lot for a one-day event. Cars arrive and leave through the day. If you give every car its own space for the whole day, you need a huge lot. If you notice that the morning cars have gone by afternoon, you can reuse their spaces. The lot only needs to hold the cars that are there at the same time.

A neural network is like that. Each op writes a tensor, a later op reads it, and after the last reader the tensor is dead. The memory it used can serve the next tensor. Working out those reuses before the model ever runs is called memory planning.

Why plan ahead

On a robot, asking the operating system for memory in the middle of a frame is risky. An allocation can take an unpredictable amount of time, and on a GPU it can wait for the device. A plan made ahead of time avoids that. The runtime reserves one block, called an arena, when it starts. Every tensor then lives at a fixed offset (a distance from the start of the arena) and no allocation happens during a frame.

ExecuTorch works this way. Its documentation says memory planning is the last step before emission and that it uses each tensor's size and lifespan to "plan out their location in fixed size memory arenas". It ships two algorithms. The naive one "simply concatenates all the tensors together in a linear memory block", and the docs call it an upper bound and a baseline. The greedy one "tries to re-use the already allocated memory based on the best-fit criteria".

A lifetime is a pair of numbers

Number the ops 0 to 7. A tensor is live from the op that writes it to the last op that reads it. That pair is its lifetime. In our toy backbone, the input is live only at op 0. The result of op 1 is read again at op 3 by the skip connection, so it lives from 1 to 3. The other results live until the next op reads them.

Two tensors can share memory only if their lifetimes do not overlap. So the least memory you can ever need is the largest total of tensors live at the same op. That lower bound is easy to find by sweeping across the ops.

The sweep, by hand

All sizes are FP16 bytes, with the shapes from Chapter 3.

  1. Op 0 has the input (301,056) and its result (401,408) live: 702,464.
  2. Op 1 has the op 0 result (401,408) and the new op 1 result (401,408): 802,816.
  3. Op 2 has the op 1 result still waiting for the skip (401,408) and the new op 2 result (200,704): 602,112. The op 1 result is live, and so is the op 2 result, but the op 0 result is dead.
  4. Op 3 reads the op 1 result and the op 2 result and writes its own (200,704): 401,408 + 200,704 + 200,704 = 802,816.
  5. Later ops need less: 301,056, then 200,704, then 150,528, then 52,176.

peak live = max(702,464; 802,816; 602,112; 802,816; …) = 802,816 bytes

naive sum of all nine tensors = 1,758,160 bytes

The best any plan can do is 802,816 bytes. The naive plan uses 1,758,160, which is 2.19 times as much. Peak memory is not the sum of the tensors. It is the biggest crowd at one moment.

Placing tensors: greedy

Now give each tensor an offset. A simple greedy method goes through the tensors and puts each at the lowest offset where it does not collide with any tensor that is live at the same time. The order of the walk matters. In the device below, going in order of first use needs 1,103,872 bytes. Going from the biggest tensor to the smallest reaches the lower bound of 802,816 bytes. Big tensors are hard to place, so you place them while there is still room. The ExecuTorch greedy algorithm is a cousin of this one that uses a best-fit rule, so treat our version as a model of the idea, not a copy of its code.

Pack the arena

The horizontal axis is the op number. The vertical axis is memory. Each box is a tensor, as wide as its lifetime and as tall as its size. Choose a plan, then drag to place the tensors one at a time.

9

The nine tensors are the toy backbone's real FP16 sizes with the skip connection from Chapter 1. The planner is a teaching version of greedy offset assignment; ExecuTorch's own algorithm is described in its memory planning documentation.

In-place ops and weight layout

An in-place op writes its result over its own input. This is safe only when that input has no later reader. A ReLU after a convolution usually qualifies. In the lifetime picture, it means the output starts exactly where the input ends and takes the same offset. Weights are different. They are fixed numbers stored in the model file, not live tensors, and the compiler rearranges them into the layout the NPU likes (for example, channels-last) once, ahead of time.

One more detail from the ExecuTorch docs: for models whose outputs feed the next inference, such as a recurrent state, it is "generally better to not memory plan the IO", so you can pass the same buffer in and out and avoid a copy.

Failure mode. Symptom: most frames are fast, and every so often one is much slower. Measurement: log the time of each frame and look for a regular pattern, then trace allocator calls in the loop. Fix: allocate once, before the loop, and reuse. If your runtime allocates inside the loop (for example, CUDA allocation calls), switch to a preallocated pool or an arena.

On real hardware: on an NVIDIA Jetson Orin Nano developer kit, run your model for 10,000 frames, record each frame time, and plot a histogram. A long tail with a regular rhythm points to allocation or a periodic system task. Then run the same test with the allocations moved out of the loop.

Two tensors can use the same bytes of the arena when:

Chapter 7

Quantised Graphs and QDQ

See how a graph marks where numbers are INT8 and where they are float, and why one op without INT8 support adds two conversions

Your NPU is fastest on 8-bit integers. Your model was trained in 32-bit floats. Somewhere between the two, every number must be squeezed into a whole number from −128 to 127. This chapter is not about how to choose that squeeze well. The lessons on quantisation and quantisation part two cover the theory, and a later lesson in this track covers calibration and accuracy checks. Here we only ask: how does the graph record it, and how does that change the partition?

Quantise and dequantise, in one line each

Quantise turns a float into an INT8 using a scale and a zero point: q = clamp( round( x / scale ) + zero_point, −128, 127 ). Dequantise goes back: x̂ = ( q − zero_point ) × scale. Here is one number. Let scale = 0.05 and zero_point = 0. Take x = 1.234. Then x / scale = 24.68, which rounds to q = 25. Dequantising gives 25 × 0.05 = 1.25. The error is 0.016. Take x = 7.0 instead: x / scale = 140, but 127 is the maximum, so q = 127 and the result is 6.35. That clipping is the price of a small scale.

The QDQ format

ONNX has two ways to write a quantised graph. In the QOperator style, each quantised op gets its own definition, like QLinearConv. In the QDQ style, the original ops stay as they were and the graph is wrapped with QuantizeLinear and DequantizeLinear nodes. The ONNX Runtime documentation describes QDQ as inserting a DeQuantizeLinear(QuantizeLinear(tensor)) pair between the original operators, and says the pair carries the quantisation parameters. It also says that quantisation-aware models exported from PyTorch, and models converted from TFLite, are already in QDQ form.

QDQ is a hint-based format. Each pair says: this tensor may be INT8, with this scale. A backend that runs INT8 reads the hints and keeps tensors in INT8 between ops. A backend that does not simply runs the float graph.

What the nodes look like

Where does the scale come from? A simple rule picks the scale from the largest magnitude a tensor reaches. If a tensor never exceeds 6.35 in size, scale = 6.35 / 127 = 0.05, which is the scale used above. This is why a tensor with one large outlier gets a coarse scale: the outlier stretches the range, and every other value loses precision.

Here is a Conv, ReLU, Conv chain in QDQ form, as a list of nodes in order.

QDQ form of Conv, ReLU, Conv (nodes in order) QuantizeLinear input scale s0 DequantizeLinear s0 Conv QuantizeLinear scale s1 DequantizeLinear s1 Relu QuantizeLinear scale s2 DequantizeLinear s2 Conv QuantizeLinear scale s3 DequantizeLinear s3 (graph output)

On paper, four pairs of conversions stand around three ops. A backend that runs INT8 reads the pairs as hints, fuses each DQ, op, Q group into one INT8 op, and drops the pairs in between. Only the first Q and the last DQ really run. A backend that does not understand a given pair leaves it in place, and you pay for it.

Where QDQ meets the partitioner

Suppose a chain of six ops runs in INT8 on the NPU. Between neighbouring INT8 ops, the pairs can cancel: no need to turn a tensor back into a float just to quantise it again. Only the ends remain: one Quantise at the input and one Dequantise at the output.

Now suppose one op in the middle has no INT8 version. It must run in float. Its input must be dequantised first, and its output quantised again. The INT8 region is now split in two. This looks just like Chapter 2.

conversions
The number of Quantise and Dequantise nodes that actually run. The graph input and output are float.
islands
The number of separate runs of ops that stay in INT8.

One island has 2 conversions. A float op in the middle makes 2 islands and 4 conversions. A float op at the very start or end leaves 1 island and 2 conversions. The pattern is the same as the copy count: the edge is cheaper than the middle.

Count the conversions

Six ops. Pick the one that has no INT8 version. Blue ops run in INT8. The warm op runs in float. Small markers are Quantise (Q) and Dequantise (DQ) nodes that really run.

Each conversion costs 0.06 ms in this toy model (illustrative). Real cost depends on the tensor size and the backend. The rule conversions = 2 x islands assumes float graph inputs and outputs and cancelling pairs between INT8 ops.

The cost is more than the conversions. If the float op also runs on the CPU, you pay the copies and syncs of Chapter 3 on top. If the NPU can run it in float, you pay only the conversions. Either way, a QDQ pair wrapped around an op that does not support INT8 is a signal that the backend will churn: dequantise, compute, requantise, on every frame.

Failure mode. Symptom: the INT8 model is barely faster than the float one. Measurement: count the Q and DQ nodes in the exported graph and compare with 2 x the number of islands you expected. More nodes means more islands. Fix: rewrite or move the op as in Chapter 5, or keep the op in float and place it at an edge.

The ONNX Runtime pages also warn that quantisation needs a recent enough opset (10 or higher for quantisation, and 12 or higher for 8-bit support of some operators), and that on GPU only S8S8 is supported. Always read the table for your backend and version.

On real hardware: on a Jetson Orin Nano developer kit, build one engine in FP16 and one in INT8 from the same ONNX file with trtexec in verbose mode. Check which layers still run in higher precision and compare the two latencies.

A chain of INT8 ops has one float-only op in the middle. How many Quantise and Dequantise nodes run?

Chapter 8

Batch 1, Dynamic Shapes and Tactics

See why a control loop wants batch size 1 and fixed shapes, and what a wide shape range costs in speed and in reserved memory

A robot arm runs a control loop at 100 Hz. Every 10 ms it must read a camera frame, run the network and send a command. A frame that arrives late is not a small problem. It is a missed deadline, and the arm acts on old information.

Training taught you to love big batches. On the robot, big batches work against you. This chapter explains why, and how the shapes you promise at export time change the engine you get.

Batch 1 is the control-loop default

A batch is the number of inputs the model processes together. Batching raises throughput, because fixed costs are shared. But to fill a batch of 4 from a single camera at 30 frames per second, you must wait for 4 frames: 3 x 33.3 ms = 100 ms of waiting. That alone is ten times the whole 10 ms loop. So for one camera in a control loop, use batch 1.

There is one safe exception. Four cameras that capture at the same instant already give you four images at once. Stacking them into a batch of 4 costs no waiting. This is micro-batching across cameras. In our illustrative model, a batch costs 1.2 ms of fixed setup plus 0.8 ms per image: four images one by one take 4 x 2.0 = 8.0 ms, and one batch of four takes 1.2 + 3.2 = 4.4 ms.

A shape range is a promise

At export time you can say an input dimension is dynamic: it may change from run to run. In torch.export you declare it with Dim("h", min=16, max=1024), as in the ExecuTorch documentation. The runtime must then work for every value in the range. A tool that lets you leave this open does not make the cost go away. The PyTorch tutorial describes Dim.AUTO, which can specialise a dimension to a constant, and Dim.DYNAMIC, which raises an error instead. A silent constant gives a graph that is not valid for every input. State your ranges on purpose.

TensorRT calls the range an optimization profile. Its documentation says a profile "describes a range of dimensions for each network input and the dimensions the auto-tuner will use for optimization". You give a minimum, an optimum and a maximum. The page's example is min (3, 100, 200), opt (3, 150, 250) and max (3, 200, 300). ONNX Runtime's TensorRT provider takes the same three values through provider options and infers them if you do not.

Worked example: two cameras at once

Two cameras fire on the same hardware trigger every 33.3 ms. Their frames arrive together, so a batch of 2 has no waiting. With the illustrative model, two images one by one take 2 x 2.0 = 4.0 ms. One batch of two takes 1.2 + 1.6 = 2.8 ms, which saves 1.2 ms of every 33.3 ms frame. Now suppose the cameras are not synchronised and one frame arrives 12 ms after the other. Batching would hold the first frame for 12 ms to save 1.2 ms. That is a bad trade. Batch only what already arrived together.

Two costs of a wide range

First, tactics. Recall from Chapter 4 that a tactic is one way to run a layer. The TensorRT documentation says: "Some operations have tactics that only work for MIN=OPT=MAX, so when these values differ, the tactic is disabled." A fixed shape keeps all tactics open. A range closes some. The tuner also optimises for the opt shape, so a run far from opt gets a plan that was not tuned for it. How much you lose depends on the model, so measure it.

Second, memory. The memory planner of Chapter 6 must reserve for the worst case. ExecuTorch's documentation says it uses the shape bounds both to optimise the model and to plan memory. Take one layer that keeps full resolution with 64 channels, in FP16. At 224 x 224 its output is 64 x 224 x 224 x 2 = 6,422,528 bytes. With a maximum of 1024 x 1024 it is 64 x 1024 x 1024 x 2 = 134,217,728 bytes, which is 20.9 times larger. You pay for the maximum on every frame, even when the images are small. The TensorRT docs agree in spirit: "The memory usage for different profiles can change dramatically."

Pick a profile

The engine is tuned for 224 pixels. Choose how wide a range you promised, then drag the actual input size. Look at the speed bars and the reserved memory.

224 px

The memory bars are exact arithmetic for one 64-channel FP16 layer at full resolution. The tactic penalties (1.00, 1.08, 1.25) and the 2.0 ms base time at 224 pixels are illustrative, not measured; they show the direction the TensorRT docs describe. A fixed engine cannot run other sizes: it is shown at its one size only.

Two practical rules come out of this. First, if your control loop sees one image size, build for that size. Second, if you must support a few sizes, use a few narrow profiles rather than one wide one. The TensorRT docs say two profiles may have disjoint or overlapping ranges.

Failure mode. Symptom: the exported model is slower than a quick test with a fixed shape, and its memory use is high. Measurement: build the same model with min = opt = max and compare latency and memory with the dynamic build. Fix: fix the shapes for control loops: resize or pad inputs to a small set of sizes, and build one engine or profile for each.

On real hardware: on a Jetson Orin Nano developer kit, build the engine with trtexec using its minimum, optimum and maximum shape options (see trtexec --help for the exact names in your version). Run once with equal values and once with a wide spread. Compare the latency and the memory the tool reports.

Why does a wide dynamic-shape range hurt both speed and memory?

Chapter 9

Field Guide

Keep the numbers, the checklist and the partitioner in one place, and know where to go next

The whole lesson fits in one sentence. A model reaches the accelerator as a graph, a partitioner cuts that graph wherever an op is unsupported, and every cut adds copies and waiting that a faster accelerator cannot remove. So you read the cut first, then remove or move the ops that cause it.

The numbers

QuantityValueWhere it comes from
Input tensor, 3 x 224 x 224 FP16301,056 BArithmetic: 3 x 224 x 224 x 2
Toy baseline, all on the NPU2.043 msIllustrative model, Chapter 3
Op in slot 4 on the CPU4.904 ms (x2.40)Illustrative model, 3 partitions, 4 copies
Op in slot 8 on the CPU3.551 ms (x1.74)Illustrative model, 2 partitions, 2 copies
Copies from a cut chain2 x NPU partitionsDerived in Chapter 2
Peak memory vs naive sum802,816 vs 1,758,160 BArithmetic, Chapter 6
GELU tanh form, largest error0.00047 at x = 2.70Computed over -6 to 6
ExecuTorch 1.0 general availability22 October 2025PyTorch blog; Arm newsroom
TensorFlow Lite renamed LiteRT4 September 2024Google developers blog

The terms

TermMeaning in one line
PartitionAn unbroken run of ops on one backend.
FallbackRunning an unsupported op on the CPU instead.
CrossingOne copy plus one sync between host and accelerator memory.
DelegateThe part of a runtime that hands a subgraph to an accelerator.
Execution providerONNX Runtime's name for a backend in its priority list.
Engine or planTensorRT's compiled model, tied to a device type and a version by default.
Optimization profileThe min, opt and max shapes an engine is built for.
ArenaOne block of memory reserved once, with every tensor at a planned offset.
QDQQuantise and dequantise nodes that mark where a tensor may be INT8.

The delegation-report checklist

The partitioner as code

This is the whole idea of the lesson in a short Python program. It runs as written and prints the three cases from the hero.

pythonSIZES = [401408, 401408, 200704, 200704, 100352, 100352, 50176, 2000]
IN_BYTES = 301056

def partition(supported):
    """Cut a chain into runs of one backend. supported[i] is True if the NPU can run op i."""
    parts = []
    for i, ok in enumerate(supported):
        dev = "npu" if ok else "cpu"
        if parts and parts[-1][0] == dev:
            parts[-1][2] = i
        else:
            parts.append([dev, i, i])
    return parts

def latency(supported, npu=0.10, act=0.04, cpu_op=1.5, bw=1e6, sync=0.5, custom=3):
    """ms per frame. bw in bytes per ms. Graph input and output live on the host."""
    sizes = [IN_BYTES] + SIZES
    t, loc, copies = 0.0, "cpu", 0
    for i, ok in enumerate(supported):
        dev = "npu" if ok else "cpu"
        if dev != loc:                      # a crossing: copy plus sync
            t += sizes[i] / bw + sync
            copies += 1
            loc = dev
        t += (act if i == custom else npu) if ok else cpu_op
    if loc == "npu":                        # the answer must come back to the host
        t += sizes[8] / bw + sync
        copies += 1
    return t, copies

for name, slot, on_npu in [("all NPU", 3, True), ("op 4 on CPU", 3, False), ("op 8 on CPU", 7, False)]:
    sup = [on_npu or i != slot for i in range(8)]
    t, c = latency(sup, custom=slot)
    print(f"{name:12s} partitions={len(partition(sup))} copies={c} latency={t:.3f} ms")

The output is all NPU partitions=1 copies=2 latency=2.043 ms, then op 4 on CPU partitions=3 copies=4 latency=4.904 ms, then op 8 on CPU partitions=2 copies=2 latency=3.551 ms. A real partitioner also handles branches and the cycle rule of Chapter 2.

Where this sits

The tools change every year: ExecuTorch, LiteRT and TensorRT all moved in the last two. The partition does not. Learn to read a report and to count crossings, and a new toolchain is a new syntax for an old idea. A related lesson on custom operators and plugins in this track covers writing an op the backend lacks, and calibration and parity checks for INT8. The lesson on DRAM and bandwidth earlier in this series, on memory systems, explains why copies cost what they cost.

Keep going

Sources

  1. ExecuTorch documentation: partitioner and delegation, export workflow, memory planning.
  2. Introducing ExecuTorch 1.0, PyTorch blog, 22 October 2025.
  3. ONNX Runtime: execution providers, TensorRT provider, troubleshooting, quantization.
  4. NVIDIA TensorRT documentation: dynamic shapes, engine compatibility, DLA.
  5. Google: TensorFlow Lite is now LiteRT, and the LiteRT delegates guide.
  6. PyTorch: torch.export tutorial.
The takeaway. A faster accelerator shortens the part of the frame that already ran fast. The cuts, copies and waits around an unsupported op stay the same. Read the partition report first. Then remove the cut, or move it to the edge.

Now press Present or Teach and explain from memory why one op in the middle costs more than the same op at the end. Then go back to the graph at the top, switch off NPU support, and drag the op to each slot. Predict the partition and copy counts before you look.

After a runtime upgrade your model is slower. What do you check first?
Physical AI Systems, edge track, lesson 1
ExecuTorch documentation · ONNX Runtime execution providers · Back to Gleams