-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Fixed issues with dtype in geom functional transforms v2 #7211
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
Fixed issues with dtype in geom functional transforms v2 #7211
Conversation
… proto-apply-grid-transform-restore-dtype-cast
) -> torch.Tensor: | ||
|
||
fp = img.dtype == grid.dtype |
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.
Could you please explain why we're sure that img.dtype is float iff it's the same as the grid dtype? Can't we just use is_floating_dtype()
?
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.
yes, we can use is_floating_dtype
. I used a context knowledge that grid should have float dtype
Thanks for the PR @vfdev-5 . It's not really clear to me which bugs this issue is trying to address. Could you help me understand? |
@NicolasHug This addresses the second point in #7159 (comment). TL;DR You saw tests for |
…d-transform-restore-dtype-cast
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.
LGTM, thanks @vfdev-5!
Hey @vfdev-5! You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py |
) Summary: Co-authored-by: Philip Meier <[email protected]> Reviewed By: vmoens Differential Revision: D44416263 fbshipit-source-id: 4bf99470ac106dd8d1c15fa2e217e865508650d4
Description story:
Philip (@pmeier) tried to check if other floating types are working for the transforms: f16, f64 etc. here: #7195
It seems that f16 is not even working for stable one (ref). But for f64 we had few issues that this PR is supposed to fix.
Some transforms can't work properly for f64, e.g. perspective. Jit is inconsitent etc
cc @bjuncek @pmeier