es-ude / es-ude/OnDeviceTraining

optimizer: rename optimizer_t.sizeStates — it counts tracked parameters, not states

Open
#314 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.