-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix Python buffer handling #7125
Merged
Merged
Commits on Oct 26, 2022
-
In the category of "how did this ever work"... TL;DR: in general, Halide Buffers have the opposite axis ordering from Python/NumPy buffers; in Halide, the most-frequently-varying dimension comes first, while in Python, it comes last. This isn't surprising, though, since Halide's indexing scheme is effectively column-major while NumPy's is row-major. Anyway: what we *should* have done was to reverse the order of dimensions when converting to/from Halide Buffers vs Python buffers; instead, we kept the same order, then jumped thru hoops to rearrange buffers to fit this setup. This PR does the appropriate axis reordering, fixing the apps and tests as needed. It also adds some helper code for image reading and writing; by default, we use `imageio` for this, but imageio ~always wants RGB/RGBA images to be interleaved (vs the planar that Halide prefers). So, I added the `halide.imageio` package, that has wrapper functions to quietly convert to/from planar as needed. Needless to say, this change is likely to break existing code that is using 3d buffers in Halide, but I think it's the right long-term thing to do. Opinions greatly welcomed here.
Configuration menu - View commit details
-
Copy full SHA for 9bb320f - Browse repository at this point
Copy the full SHA 9bb320fView commit details -
Configuration menu - View commit details
-
Copy full SHA for f5785dc - Browse repository at this point
Copy the full SHA f5785dcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 040f5e4 - Browse repository at this point
Copy the full SHA 040f5e4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 523c18b - Browse repository at this point
Copy the full SHA 523c18bView commit details -
Configuration menu - View commit details
-
Copy full SHA for d2bc100 - Browse repository at this point
Copy the full SHA d2bc100View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8a4bcaf - Browse repository at this point
Copy the full SHA 8a4bcafView commit details
Commits on Oct 27, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 946dfea - Browse repository at this point
Copy the full SHA 946dfeaView commit details -
add 'reverse_axes' options to Buffer conversions (#7127)
* add 'reverse_axes' options to Buffer conversions
Configuration menu - View commit details
-
Copy full SHA for 25ac02e - Browse repository at this point
Copy the full SHA 25ac02eView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.