-
-
Notifications
You must be signed in to change notification settings - Fork 3
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 batch transform decorator #46
Conversation
Reviewer's Guide by SourceryThis PR introduces a new batch transform decorator that enables efficient handling of batch transformations for image processing operations. The decorator supports different types of transformations (spatial, channel, and full) and handles various input tensor shapes including 2D and 3D data with optional batch and depth dimensions. Class diagram for batch transform decoratorclassDiagram
class BatchTransformType {
<<enumeration>>
spatial
channel
full
}
class ShapeType {
<<enumeration>>
DHW
DHWC
NHW
NHWC
NDHW
NDHWC
}
class Decorator {
+batch_transform(transform_type: BatchTransformType, has_batch_dim: bool, has_depth_dim: bool, keep_depth_dim: bool): Callable[[F], F]
}
class ReshapeFunctions {
+reshape_for_spatial(data: np.ndarray, has_batch_dim: bool, has_depth_dim: bool, keep_depth_dim: bool): tuple[np.ndarray, tuple[int, ...]]
+reshape_for_channel(data: np.ndarray, has_batch_dim: bool, has_depth_dim: bool, keep_depth_dim: bool): tuple[np.ndarray, tuple[int, ...]]
}
class RestoreFunctions {
+restore_from_spatial(data: np.ndarray, original_shape: tuple[int, ...], has_batch_dim: bool, has_depth_dim: bool, keep_depth_dim: bool): np.ndarray
+restore_from_channel(data: np.ndarray, original_shape: tuple[int, ...], has_batch_dim: bool, has_depth_dim: bool, keep_depth_dim: bool): np.ndarray
}
Decorator --> BatchTransformType
Decorator --> ReshapeFunctions
Decorator --> RestoreFunctions
ReshapeFunctions --> ShapeType
RestoreFunctions --> ShapeType
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #46 +/- ##
=======================================
Coverage ? 62.21%
=======================================
Files ? 21
Lines ? 2554
Branches ? 0
=======================================
Hits ? 1589
Misses ? 965
Partials ? 0 ☔ View full report in Codecov by Sentry. |
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 and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟡 Complexity: 1 issue found
- 🟢 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.
Summary by Sourcery
Add a batch transform decorator to facilitate batch transformations for spatial and channel data, along with utility functions for reshaping and restoring data. Update project version and CI configuration, and introduce tests for the new functionality.
New Features:
Enhancements:
Build:
CI:
Tests: