mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-03-12 19:23:36 -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.
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
"""
|
|
Integration Tests for Module XX: [Module Name]
|
|
Template for testing integration with dependencies
|
|
"""
|
|
|
|
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 TestDependencyIntegration:
|
|
"""Test integration with prerequisite modules."""
|
|
|
|
def test_works_with_tensor(self):
|
|
"""Test integration with Tensor (if applicable)."""
|
|
# Example:
|
|
# from tinytorch.core.tensor import Tensor
|
|
# from tinytorch.core.module import MainClass
|
|
#
|
|
# t = Tensor(np.array([1, 2, 3]))
|
|
# obj = MainClass()
|
|
# result = obj.process(t)
|
|
# assert isinstance(result, Tensor)
|
|
pass
|
|
|
|
def test_output_consumed_by_next_module(self):
|
|
"""Test output can be consumed by dependent modules."""
|
|
# Example:
|
|
# from tinytorch.core.module import MainClass
|
|
# from tinytorch.next.module import NextClass
|
|
#
|
|
# obj1 = MainClass()
|
|
# output = obj1.process(input_data)
|
|
#
|
|
# obj2 = NextClass()
|
|
# final = obj2.process(output)
|
|
# assert final is not None
|
|
pass
|
|
|
|
def test_chaining_operations(self):
|
|
"""Test chaining multiple operations."""
|
|
# Example:
|
|
# obj = MainClass()
|
|
# result = obj.operation1().operation2().operation3()
|
|
# assert result is not None
|
|
pass |