mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-08 02:28:25 -05:00
Closes #1298 (test coverage for the API additions landed in #1391 plus the deferred view/masked_fill that arrived in the same merge window). Ten focused tests in TestTensorPyTorchCompat verify the methods students are most likely to call when porting PyTorch training loops to TinyTorch: - ndim matches len(shape) for rank 0-3 tensors - numel() equals .size - view() is a reshape alias, including -1 inference - contiguous() returns correct data and guarantees C-order layout - masked_fill basic replacement and the -inf attention-mask pattern - masked_fill does not mutate the original tensor - Tensor([t1, t2]) stacking constructor Each test targets one specific behavioral contract so failures pinpoint exactly which method regressed.