Skip to content

refactor(examples): consolidate v1/v2 into one factory-API trainer per example#251

Merged
LeoBuron merged 1 commit into
developfrom
examples-consolidate-v1v2
Jun 26, 2026
Merged

refactor(examples): consolidate v1/v2 into one factory-API trainer per example#251
LeoBuron merged 1 commit into
developfrom
examples-consolidate-v1v2

Conversation

@LeoBuron

Copy link
Copy Markdown
Member

What

Collapses the v1/v2 example split into one factory-API trainer per example, finishing the unfinished factory-API migration.

Why

The factory-API migration created a parallel *_v2/train_c.c per example instead of replacing the original. Each example ended up with two C trainers: the Legacy-API train_c.c (redundant, never built in CI, pinned to deprecated *LayerInitLegacy + tensorInit* APIs → silently rotting) and the factory-API *_v2/train_c.c (the canonical one CI bit-parity-checks).

How

  • Move each *_v2/train_c.c (factory API + StateDictApi) into its parent dir; delete the Legacy train_c.c and the *_v2/ dirs. Targets keep their canonical names (train_c_har_classifier, train_c_ecg_anomaly_ae).
  • Rewire the CI c-bit-parity job + examples/CMakeLists.txt to the consolidated targets/paths.
  • Rewrite both READMEs to the real flow (bit-parity primary; train-from-scratch demo secondary).
  • Make ECG compare.py informational — the train-from-scratch comparison is a sanity check, not a gate (independent init + a C-vs-PyTorch training-dynamics difference push the anomaly AUC outside tolerance; bit-parity is the exact gate). That divergence is a known finding under separate investigation.

Verification

Builds on #250 (Issue C factory init), already merged to develop.

🤖 Generated with Claude Code

…r example

The factory-API migration left a parallel _v2 C trainer per example (har_classifier_v2, ecg_anomaly_ae_v2) alongside the original Legacy-API train_c.c, which was redundant, never built in CI, and pinned to deprecated APIs. Collapse to one directory per example.

Move each _v2 train_c.c (factory API + StateDictApi) into its parent dir; delete the Legacy train_c.c and the _v2 dirs; targets keep their canonical names (train_c_har_classifier, train_c_ecg_anomaly_ae). Rewire the CI bit-parity job + examples/CMakeLists.txt to the consolidated targets/paths. Rewrite the two READMEs to the real flow (bit-parity primary).

Make ECG compare.py informational: the train-from-scratch comparison is a sanity check, not a gate (independent init + a C-vs-PyTorch training-dynamics difference push the anomaly AUC outside tolerance; bit-parity is the exact gate).

Bit-parity verified identical for both examples (HAR int32, ECG float allclose).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@LeoBuron LeoBuron merged commit 5b996f4 into develop Jun 26, 2026
8 checks passed
@LeoBuron LeoBuron deleted the examples-consolidate-v1v2 branch June 26, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant