-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[Enhancement]Replace numpy ascontiguousarray with torch contiguous to speed-up #2604
[Enhancement]Replace numpy ascontiguousarray with torch contiguous to speed-up #2604
Conversation
Merge MMSegmentation 1.x development branch dev-1.x to main branch 1.x for v1.0.0rc2
Codecov ReportBase: 83.25% // Head: 83.35% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev-1.x #2604 +/- ##
===========================================
+ Coverage 83.25% 83.35% +0.09%
===========================================
Files 145 145
Lines 8505 8508 +3
Branches 1273 1274 +1
===========================================
+ Hits 7081 7092 +11
+ Misses 1213 1202 -11
- Partials 211 214 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
… speed-up (open-mmlab#2604) ## Motivation Original motivation was after [MMDetection PR #9533](open-mmlab/mmdetection#9533) With several experiments I found out that if a ndarray is contiguous, numpy.transpose + torch.contiguous perform better, while if not, then use numpy.ascontiguousarray + numpy.transpose ## Modification Replace numpy.ascontiguousarray with torch.contiguous in [PackSegInputs](https://github.com/open-mmlab/mmsegmentation/blob/1.x/mmseg/datasets/transforms/formatting.py) Co-authored-by: MeowZheng <[email protected]>
Motivation
Original motivation was after MMDetection PR #9533
With several experiments I found out that if a ndarray is contiguous, numpy.transpose + torch.contiguous perform better, while if not, then use numpy.ascontiguousarray + numpy.transpose
Modification
Replace numpy.ascontiguousarray with torch.contiguous in PackSegInputs