File size: 3,294 Bytes
bcfba4b
 
 
 
 
 
 
 
 
 
 
 
11db306
bcfba4b
 
 
 
a20e72a
bcfba4b
f11d542
 
 
 
11db306
f11d542
 
 
11db306
 
 
 
499e669
 
 
 
 
f11d542
 
 
 
d28a64e
 
 
 
11db306
d28a64e
11db306
bcfba4b
f11d542
 
 
 
 
 
bcfba4b
 
 
f11d542
bcfba4b
f11d542
bcfba4b
 
 
11db306
003f748
c567177
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
license: apache-2.0
tags:
- executorch
- xnnpack
- pte
- on-device
- image-to-image
- super-resolution
base_model:
- eugenesiow/edsr-base
---
# edsr_base_x4 β€” ExecuTorch

- **Source**: eugenesiow/edsr-base (super-image)
- **License**: Apache-2.0
- **Input**: [[1, 3, 128, 128]] β€” RGB 0-1, 128x128 tile
- **Output**: SR image [1,3,512,512] RGB, nominally 0-1 but not clamped by the model β€” it overshoots on high-contrast edges (measured: 0.7% of pixels outside 0-1, range -0.02 to 1.06 over ten tiles). Clamp before display.

## Variants

All variants take and return fp32 tensors β€” swap the `.pte` file, keep your app code.

| build | file | size (MB) | parity vs fp32 eager (worst corr) | Mac median (ms)* |
|-----------|------|-----------|------------------------------------|------------------|
| fp32 | `edsr_base_x4_xnnpack_fp32.pte` | 6.1 | 1.000000 | 38.9 |
| int8 | `edsr_base_x4_xnnpack_int8.pte` | 1.6 | 0.999918 | 28.3 |
| Core ML (fp16, iOS) | `edsr_base_x4_coreml_all.pte` | 3.3 | 0.999999 | 8.4 |


The Core ML build is the same graph lowered to Apple's Neural Engine instead of
XNNPACK, which is CPU-only. Measured on an iPhone 17 Pro across seven models, it
runs **3.5x to 13.9x faster (median 12x)** at roughly half the file size β€” for
example Depth-Anything-V2-Small at 500.8 ms against 42.7 ms, and MODNet at 81.7 ms
against 5.9 ms. It computes in fp16 and is iOS-only; the XNNPACK files stay the
portable option and are what runs on Android.

\*Mac arm64, single process, median of 10 β€” a reference point for relative cost
only, not a device number (torch eager fp32 on the same machine: 77.9 ms).

### Checked in the task's own units

Correlation is a first filter. These are the numbers that decide:

- **int8** β€” measured in the units that matter for this model β€” PSNR vs the fp32 .pte (dB): median 47.3870 over 10 real images, worst 43.1846.

### Builds that did not earn a slot

- **fp16 is not shipped**: it comes out at 100% of the fp32 file (6.1 MB vs 6.1 MB), so it buys nothing. XNNPACK serializes convolution weights as fp32 no matter what dtype the graph carries, so on a conv-heavy model fp16 saves no disk and only adds cast operations. Reach for int8 here, not fp16.

## Verification (executorch 1.4.0, torch 2.13.0)

Parity is measured against the fp32 eager model on real image input; `corr` is
the correlation over all elements of each output tensor.

| output | shape | max_abs_diff | corr |
|--------|-------|--------------|------|
| 0 | [1, 3, 512, 512] | 1.788e-06 | 1.000000 |

XNNPACK delegate coverage (fp32): 85.7% (96/112 ops); ops left on the portable kernels: `dim_order_ops._to_dim_order_copy.default` x16

## Conversion

torch.export -> to_edge_transform_and_lower(partitioner) -> .pte
(conversion scripts: [executorch-models](https://github.com/john-rocky/executorch-models))

<!-- funnel:v1 -->

---

**More models in this format:** [ExecuTorch Model Zoo](https://huggingface.co/collections/mlboydaisuke/executorch-model-zoo-6a7ff328390b63075ffeae5e) β€” 31 models, each with the recipe that produced it.

**Want a different model on-device?** [Open a request](https://github.com/john-rocky/on-device-requests) β€” free, open weights only; the export and its measured numbers get published publicly.

<!-- /funnel:v1 -->