mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-04-30 00:57:30 -05:00
Fix test imports to use rock solid foundation approach
- Update all test files to import from tinytorch.core.* instead of relative paths - Consistent with rock solid foundation principle - Tests now use stable package imports, not local module imports - Ensures tests validate the actual exported package functionality - Aligns with production usage patterns
This commit is contained in:
@@ -1,24 +1,15 @@
|
||||
"""
|
||||
Tests for TinyTorch Tensor module.
|
||||
|
||||
Tests the core tensor functionality including creation, arithmetic operations,
|
||||
utility methods, and edge cases.
|
||||
|
||||
These tests work with the current implementation and provide stretch goals
|
||||
for students to implement additional methods.
|
||||
Test suite for the tensor module.
|
||||
This tests the student implementations to ensure they work correctly.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import pytest
|
||||
import numpy as np
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add the parent directory to path to import tensor_dev
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
||||
|
||||
# Import from the module's development file
|
||||
# Note: This imports the instructor version with full implementation
|
||||
from tensor_dev import Tensor
|
||||
# Import from the main package (rock solid foundation)
|
||||
from tinytorch.core.tensor import Tensor
|
||||
|
||||
def safe_numpy(tensor):
|
||||
"""Get numpy array from tensor, using .numpy() if available, otherwise .data"""
|
||||
|
||||
Reference in New Issue
Block a user