Files
foxhunt/ml/src/tft
jgrusewski 3c8039527c fix(ml): TFT memory leak fixes - 98% reduction
TFT Memory Leak Fixes (8 applied):
- Fixed compute_quantile_loss() tensor leaks (22→7 tensors per batch)
- Detached LSTM initial states (.clone()→.detach())
- Detached attention cache weights (prevent graph retention)
- Replaced .repeat() with .broadcast_as() (31.5MB→0MB materialization)
- Pre-allocated LSTM outputs (eliminated 120 clones)
- Added clear_cache() method to TFTState
- Removed disabled files (quantized_attention.rs.disabled, quantized_tft.rs.disabled)
- Fixed shallow_clone compilation error (Candle API compatibility)

Impact:
- Memory leak: +3220MB → ~50MB (98.4% reduction)
- Tests: 90/90 passing (2 ignored GPU tests)
- Compilation: Successful (10 non-critical warnings)

Investigation via 6 parallel agents using zen/corrode MCP tools

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 12:50:00 +01:00
..