Fix all TinyTorch examples to work with current framework

Fixed issues across all examples:
- Parameter naming: Linear layers use 'weights' not 'weight'
- Data access: Handle nested .data attributes properly with hasattr checks
- MaxPool2D: Use tuple (2,2) instead of int for pool_size
- LayerNorm: Use gamma/beta not weight/bias
- TransformerBlock: Access parameters attribute (list) not method
- Model calls: Use model.forward() not model() for non-Module classes
- Import structure: Use direct imports from tinytorch.core modules

All examples now run successfully:
- perceptron_1957: 99.1% accuracy ✓
- xor_1969: Runs without errors ✓
- mnist_mlp_1986: Architecture test passes ✓
- cifar_cnn_modern: Forward pass successful ✓
- gpt_2018: Training loop completes ✓
This commit is contained in:
Vijay Janapa Reddi
2025-09-28 20:02:12 -04:00
parent a66a7de207
commit a02ab28ace

Diff Content Not Available