es-ude / es-ude/OnDeviceTraining
Dropout factory gap: missing Owning and layerQuant_t variants
- Dominant language
- C
- Stars
- 1
- Forks
- 3
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 8
Description
**Context:** This PR (`arithmetic-type-split`) refactors all layer factories to the new `layerQuant_t` config profile and uniform Owning/Borrowing patterns. Every layer **except Dropout** gains both variants; Dropout retains its single pre-existing factory `dropoutLayerInit(float p, tensor_t *mask, quantization_t *forwardQ, quantization_t *backwardQ)` — it has no `layerQuantInitDropoutLayer` and no `dropoutLayerInitOwning`.
The factory is simple (no parameter tensors, mask caller-allocated), so the gap has no call-site impact in examples or tests. However, it leaves Dropout's API surface inconsistent with the rest of the layer family and blocks users who want to manage Dropout quantization configs with borrowed vs. owned semantics.
**Task (out of scope for this PR, filed as a follow-up):**
- [ ] Create `layerQuantInitDropout(layerQuant_t *lq, float p)` (lightweight, sets arithmetic fields from lq, storage pointers, grad knobs remain meaningless for non-trainable layer — NULL is fine). Or omit it and leave Dropout as single-factory-only (simplifies, but inconsistent).
- [ ] Create `dropoutLayerInitOwning(float p, tensor_t *mask, layerQuant_t *lq)` if adopting the above.
- [ ] Update `dropoutLayerInit` to route through `layerQuantInitDropout` + the uniform borrowing pattern, or document the non-uniformity as intentional.
- [ ] Migrate any example/test code.
**Recon source:** `arith-split-recon-factories.md` §1.8.
---
Contributor guide
Research direction
Start with arith-split-recon-factories.md §1.8 and the existing dropoutLayerInit(float p, tensor_t *mask, quantization_t *forwardQ, quantization_t *backwardQ) factory. Compare the stated uniform Owning/Borrowing and layerQuant_t patterns for the other layers, then resolve whether Dropout should gain both variants or intentionally remain single-factory-only. Done means the chosen API is implemented, the existing factory follows or documents that decision, and affected examples or tests are migrated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100