mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-03-09 23:02:00 -05:00
- Create professional examples directory showcasing TinyTorch as real ML framework - Add examples: XOR, MNIST, CIFAR-10, text generation, autograd demo, optimizer comparison - Fix import paths in exported modules (training.py, dense.py) - Update training module with autograd integration for loss functions - Add progressive integration tests for all 16 modules - Document framework capabilities and usage patterns This commit establishes the examples gallery that demonstrates TinyTorch works like PyTorch/TensorFlow, validating the complete framework.
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
"""
|
|
Core Functionality Tests for Module XX: [Module Name]
|
|
Template for testing core module functionality
|
|
"""
|
|
|
|
import numpy as np
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Add project root to path
|
|
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
|
|
|
|
|
class TestCoreFeatures:
|
|
"""Test core functionality of the module."""
|
|
|
|
def test_basic_creation(self):
|
|
"""Test basic object creation."""
|
|
# Example:
|
|
# from tinytorch.core.module import MainClass
|
|
# obj = MainClass()
|
|
# assert obj is not None
|
|
pass
|
|
|
|
def test_core_operation(self):
|
|
"""Test main operation of the module."""
|
|
# Example:
|
|
# obj = MainClass()
|
|
# result = obj.process(input_data)
|
|
# assert result.shape == expected_shape
|
|
pass
|
|
|
|
def test_edge_cases(self):
|
|
"""Test edge cases and boundary conditions."""
|
|
# Example:
|
|
# obj = MainClass()
|
|
# # Test with empty input
|
|
# result = obj.process([])
|
|
# assert result is not None
|
|
pass
|
|
|
|
def test_error_handling(self):
|
|
"""Test proper error handling."""
|
|
# Example:
|
|
# with pytest.raises(ValueError):
|
|
# obj = MainClass(invalid_param=-1)
|
|
pass |