es-ude / es-ude/OnDeviceTraining
optimizer: rename optimizer_t.sizeStates — it counts tracked parameters, not states
- Dominant language
- C
- Stars
- 1
- Forks
- 3
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 8
Description
Pre-existing misnomer, sharpened by #308: `optimizer_t.sizeStates` is the number of TRACKED PARAMETERS (it sizes `parameter[]` and drives sgdZeroGrad/scaleOptimizerGradients/freeOptimSgdM), while since #308 a momentumFactor==0 optimizer has `sizeStates > 0` with `states == NULL` — actively confusing to read.
Proposal: rename to `numParameters` (or `sizeParameters`). Mechanical but cross-cutting: src/optimizer/Sgd.c + Optimizer.c/h, src/userApi/optimizer/, examples/har_classifier/mem_instrument.c, and ~50 test call sites — deliberately kept out of PR #313 (flagged in its final review).
Refs #308, PR #313.
Contributor guide
Research direction
Start by reviewing optimizer_t and its uses in src/optimizer/Sgd.c, Optimizer.c/h, and src/userApi/optimizer/. Search for sizeStates across the listed example and test call sites, including examples/har_classifier/mem_instrument.c, and rename every reference consistently. Done means the tracked-parameter count uses the new name everywhere and the full test suite passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, machine-learning
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100