mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-03-12 09:13:35 -05:00
CRITICAL FIXES: - Fixed Adam & SGD optimizers corrupting parameter shapes with variable batch sizes - Root cause: param.data = Tensor() created new tensor with wrong shape - Solution: Use param.data._data[:] = ... to preserve original shape CLAUDE.md UPDATES: - Added CRITICAL RULE: Never modify core files directly - Established mandatory workflow: Edit source → Export → Test - Clear consequences for violations to prevent source/compiled mismatch TECHNICAL DETAILS: - Source fix in modules/source/10_optimizers/optimizers_dev.py - Temporary fix in tinytorch/core/optimizers.py (needs proper export) - Preserves parameter shapes across all batch sizes - Enables variable batch size training without broadcasting errors VALIDATION: - Created comprehensive test suite validating shape preservation - All optimizer tests pass with arbitrary batch sizes - Ready for CIFAR-10 training with variable batches