Commit c2be5db
Github Executorch
Title:
[cortex_m] Fix linear weight layout: transpose in AOT pass, align meta/ref impl
Summary:
The linear path in ConvertToCortexMPass was not transposing weights unlike
conv2d, causing inconsistency with the C++ runtime which expects weights in
[in_features, out_features] format per CMSIS-NN.
Changes:
- convert_to_cortex_m_pass.py: Transpose linear weights [out, in] -> [in, out]
- operators.py: Update meta to use weights.shape[1] for output dimension
- operators.py: Remove .T from ref impl (weights pre-transposed by pass)
Fixes MV2 output shape mismatch: [1, 1280] -> [1, 1000]
MV2 on Corstone-300/E8 with CMSIS-NN kernels
This fix ensures the AOT-compiled .pte file has correctly shaped output
tensors for any model using quantized_linear (MV2, ResNet, MV3, etc.).1 parent 5b3d9fc commit c2be5db
File tree
2 files changed
+17
-4
lines changed- backends/cortex_m
- ops
- passes
2 files changed
+17
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
355 | | - | |
| 355 | + | |
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
| 389 | + | |
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
| 399 | + | |
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
| |||
122 | 127 | | |
123 | 128 | | |
124 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
125 | 138 | | |
126 | 139 | | |
127 | | - | |
| 140 | + | |
128 | 141 | | |
129 | 142 | | |
130 | 143 | | |
| |||
0 commit comments