ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 913 microarchs · 15,555 chips · 105 sources
Arch:
Tier:

ANE: How do I prevent my model from running on the ANE?

T3 apple-ane guide guide
Apple Neural Engine Guide — How do I prevent my model from running on the ANE?
SourceApple Neural Engine Architecture Guide (hollance/neural-engine) (apple_ane_hollance)
Reliability TierT3 — Hardware-Verified
ISA / Silicon ScopeApple A11–A19 / M1–M4 ANE
Apple A11–A19 / M1–M4 ANE
License & VersionMIT
master
Upstreamhttps://github.com/hollance/neural-engine
Note: Benchmarked and verified on Apple hardware; capabilities vary by ANE generation.

Summary

Instantiate your model as follows: let model = try MyModel(configuration: config)

Syntax / Encoding

How do I prevent my model from running on the ANE?

Reference Notes

# How do I prevent my model from running on the ANE?

Instantiate your model as follows:

```swift
let config = MLModelConfiguration()
config.computeUnits = .cpuAndGPU

let model = try MyModel(configuration: config)
```

This tells Core ML it can only use the CPU or the GPU, but not the ANE.

You can also use `computeUnits = .cpuOnly` if you don't want to use the GPU but always force the model to run on the CPU.

Why would you need to prevent Core ML from using the ANE? Perhaps you're trying to run multiple models at the same time and you want one of them to use the ANE while the others use the GPU and CPU. But most of the time I need to use this feature it is because of bugs in Core ML — some models give strange errors when you try to run them on the ANE but run fine on the GPU or CPU.