-
Notifications
You must be signed in to change notification settings - Fork 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
make convert_image_dtype scriptable #2485
Conversation
c8c30da
to
794bbb1
Compare
bde5973
to
f610463
Compare
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.
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.
Thanks a lot for the PR @nairbv and sorry for the delay in reviewing!
I've left a few comments, let me know what you think
Codecov Report
@@ Coverage Diff @@
## master #2485 +/- ##
==========================================
- Coverage 73.07% 72.95% -0.12%
==========================================
Files 96 96
Lines 8304 8319 +15
Branches 1292 1293 +1
==========================================
+ Hits 6068 6069 +1
- Misses 1838 1850 +12
- Partials 398 400 +2
Continue to review full report at Codecov.
|
@pmeier yes, let's move forward with this PR, thanks a lot for working on that other PR! |
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.
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.
* make convert_image_dtype scriptable * move convert dtype to functional_tensor since only works on tensors * retain availability of convert_image_dtype in functional.py * Update code and tests * Replaced int by torch.dtype * int -> torch.dtype and use F instead of F_t * Update functional_tensor.py Co-authored-by: vfdev-5 <vfdev.5@gmail.com>
* make convert_image_dtype scriptable * move convert dtype to functional_tensor since only works on tensors * retain availability of convert_image_dtype in functional.py * Update code and tests * Replaced int by torch.dtype * int -> torch.dtype and use F instead of F_t * Update functional_tensor.py Co-authored-by: vfdev-5 <vfdev.5@gmail.com>
I'm not sure if this is a good idea since it might be slower, but wanted to see if I could make convert_image_dtype scriptable.
iinfo isn't supported by torchscript: pytorch/pytorch#41492
This PR also moves convert_image_dtype to functional_tensor since it only applies to tensor ops, and because functional_tensor can't import from functional.