Commit 9d3445c
committed
training-platform core: drop unused loop var and populate zero-sized input defaults
Two fixes to the inputTypes / inputOffsets build loop in both
generateTrainingNetwork.py and testMVPTraining.py (the two files share
this pattern verbatim).
1. The `name` loop variable in `for graph_idx, name in enumerate(...)`
was dead — switched to `for graph_idx in range(len(...))` so the
intent is explicit and the lint warning goes away.
2. The zero-sized-input branch (`np.prod(arr.shape) == 0`) previously
`pass`ed without populating inputTypes[f"input_{idx}"] or
inputOffsets[f"input_{idx}"]. ONNX permits optional placeholder
inputs with shape like (0,) and the downstream deployer looks up
every input by key, so a zero-sized input would later raise a
confusing KeyError far from the cause. Populate the entries with
a trivial default (float32 pointer, offset 0) — the type does not
matter for codegen since the buffer has no elements, but the key
must exist.
Verified on Siracusa: simplemlp_train passes 0/4 (diff=0.000000 at every
step) in both non-tiled and tiled runs.1 parent ac4df5b commit 9d3445c
2 files changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
| |||
0 commit comments