Skip to content

fix/update: corrected torch.py and added testing suite for utility functions#519

Open
kashtennyson wants to merge 2 commits intoJdeRobot:masterfrom
kashtennyson:issue-518
Open

fix/update: corrected torch.py and added testing suite for utility functions#519
kashtennyson wants to merge 2 commits intoJdeRobot:masterfrom
kashtennyson:issue-518

Conversation

@kashtennyson
Copy link
Copy Markdown

@kashtennyson kashtennyson commented Mar 27, 2026

Overview
This PR fixes a bug in the torch utility function and introduces a comprehensive unit testing suite for torch.py and image.py. This is a fix for #518

Changes

  • utils/torch.py Fix:
    • Updated get_data_shape() to implement "passthrough" logic for non-tensor base cases (e.g., strings, labels, or None).
    • This prevents AttributeError when this function encounters metadata bundled with tensors.
  • New Unit Tests:
    • 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:

poetry run pytest tests/test_torch.py tests/test_image.py

Results: 7 passed in 1.71s (4 in torch, 3 in image).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant