fix/update: corrected torch.py and added testing suite for utility functions#519
fix/update: corrected torch.py and added testing suite for utility functions#519kashtennyson wants to merge 5 commits into
Conversation
dpascualhe
left a comment
There was a problem hiding this comment.
Besides the pending comment, can you rename the test files to something like test_utils_image.py and test_utils_torch? Thanks!
|
Renaming the test files to |
|
Hey @dpascualhe, still waiting on this PR's status and your preference on my suggestions in the previous comment. Thanks! |
|
Hi @kashtennyson , I like that suggestion! could you rename all test modules so that they mirror the directory structure within perceptionmetrics? |
Overview
This PR fixes a bug in the torch utility function and introduces a comprehensive unit testing suite for
torch.pyandimage.py. This is a fix for #518Changes
utils/torch.pyFix:get_data_shape()to implement "passthrough" logic for non-tensor base cases (e.g., strings, labels, or None).AttributeErrorwhen this function encounters metadata bundled with tensors.tests/test_torch.py: Validates recursive operations on complex, nested, and mixed-type data structures.tests/test_image.py: Verifies visualization helpers, including label formatting and annotator calls, using a robust mocking strategy.Verification
The new test modules pass successfully:
Results:
7 passed in 1.71s(4 in torch, 3 in image).