-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests to tensor v2 #2015
Add tests to tensor v2 #2015
Conversation
Reviewer's Guide by SourceryThis PR adds test coverage for the ToTensorV2 transform's handling of multiple data types (images and masks) and removes a redundant method. The changes focus on verifying that the transform correctly converts numpy arrays to PyTorch tensors for both single and multiple inputs. Sequence diagram for test_to_tensor_v2_images_maskssequenceDiagram
actor Tester
participant Transform as A.Compose([ToTensorV2(p=1)])
participant Image as SQUARE_UINT8_IMAGE
participant Mask as np.random.randint
participant Transformed
Tester->>Transform: Create transform
Tester->>Image: Prepare image
Tester->>Mask: Prepare mask
Tester->>Transform: Call transform with image, mask, masks, images
Transform->>Transformed: Return transformed data
Tester->>Transformed: Assert transformed['image'] is torch.Tensor
Tester->>Transformed: Assert transformed['mask'] is torch.Tensor
Tester->>Transformed: Assert all transformed['masks'] are torch.Tensor
Tester->>Transformed: Assert all transformed['images'] are torch.Tensor
Class diagram for ToTensorV2 transform changesclassDiagram
class ToTensorV2 {
+apply(img: np.ndarray, **params: Any) torch.Tensor
+apply_to_mask(mask: np.ndarray, **params: Any) torch.Tensor
}
note for ToTensorV2 "Removed method: apply_to_images(images: list[np.ndarray], **params: Any) list[torch.Tensor]"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ternaus - I've reviewed your changes - here's some feedback:
Overall Comments:
- The PR removes the
apply_to_images
method without explanation. Please provide context for why this method is being removed and confirm this won't break existing functionality.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2015 +/- ##
=========================================
+ Coverage 0 90.32% +90.32%
=========================================
Files 0 47 +47
Lines 0 7558 +7558
=========================================
+ Hits 0 6827 +6827
- Misses 0 731 +731 ☔ View full report in Codecov by Sentry. |
Summary by Sourcery
Add a new test case for the ToTensorV2 transformation to ensure images and masks are correctly converted to torch.Tensor, and remove the unused 'apply_to_images' method from the transforms module.
Enhancements:
Tests: