-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Make F.rotate/F.affine accept learnable params #5110
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
base: learnable_params
Are you sure you want to change the base?
Conversation
💊 CI failures summary and remediationsAs of commit 912dafb (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
5bcdd0d
to
eb826c3
Compare
Thanks a lot! I'll follow your style to work on other methods. |
|
||
# RSS without scaling | ||
sx, sy = shear_rad[0], shear_rad[1] | ||
a = torch.cos(rot - sy) / torch.cos(sy) |
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.
just wondering, could here be division by zero?
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, sy = pi/2 and same for sx=pi/2 with tan. IMO shear of ~90 degrees is too much distortion
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.
Maybe best to just protect against division by exact zero, or point it out in docs
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.
Docs however say that values between -180 and 180 are valid. I'm not sure how can we protect from zero devision if user requires 90 degree, like how to evaluate tan(pi/2) without getting infinity. Any ideas ?
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.
I don't think it should be solved in this issue since original non-tensor codes also have this problem.
Maybe we can open a new issue about this. The potential solution might be just to modify the docs or clip within a range. 90 degree shearing seems meaningless.
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, if it's not guarded against, the docs or a separate issue would be great.
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.
@vadimkantorov please create a new issue for this discussion. Thanks
@@ -464,6 +464,7 @@ def test_resized_crop_save(self, tmpdir): | |||
|
|||
|
|||
def _test_random_affine_helper(device, **kwargs): | |||
torch.manual_seed(12) |
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.
I had to add this line and fix shear value due to some random jit vs non-jit results mismatch in one pixel
Hi, @vfdev-5, sorry for being busy during the past semester. I'm currently available in the following month. Is there any problem to merge the current PR? If not, I'll draft the PR for other operators. |
We might need to hold off this PR until the situation on Transforms API v2 is clearer. I think the two can be aligned but to avoid BC breaking changes we need to think them carefully. @vfdev-5 any concerns? |
@datumbox (Maybe a question not that relevant) I'm currently doing internship at Meta ([email protected]), will that help for making contribution and communicate ideas for the issue? The basic idea for this PR is to wrap parameters with |
@ain-soph Thanks for the feedback! I've pinged you via the internal chat but for transparency and to keep the community up-to-date I'll summarize why I proposed to wait a little bit. The current prototype implementation merged on main branch doesn't have the |
@datumbox at first we can apply this PR's logic to proto low-level ops, e.g. |
Following #4995 (comment) and that PR,
here is
F.rotate
F.affine
that should be able to accept differentiable params and also be jit scriptable.
@ain-soph we can try to merge this PR at first and then you can update your PR based on this one