-
Notifications
You must be signed in to change notification settings - Fork 7.1k
extend equalize to all integer and floating dtypes #6851
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
Conversation
): | ||
image_loader = ImageLoader( | ||
fn, shape=(get_num_channels(color_space), *spatial_size), dtype=torch.uint8, color_space=color_space | ||
fn, shape=(get_num_channels(color_space), *spatial_size), dtype=dtype, color_space=color_space |
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.
Although there is a quite a diff in this file, the only functional change is to also test torch.float32
next to torch.uint8
. The rest is just refactoring to account for that.
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, some non-blocking nits.
Summary: * extend equalize to all integer and floating dtypes * address nits Reviewed By: datumbox Differential Revision: D40851020 fbshipit-source-id: 63b36f02e630b9c230431527b359876fedc52f3e
Addresses #6840 for
equalize
. Unfortunately, I need to walk back on my comment #6847 (comment): although it is possible to extend the algorithm to the other integer dtypes, it is unfeasible in practice since it blows up memory for anything larger thantorch.int16
. Thus, I opted to convert totorch.uint8
unconditionally. Fortunately, that also eliminates the decision which integer dtype we convert floating point inputs to and whether we expose this choice to the user.Since there is no change to the algorithm, I didn't benchmark this change. The only thing the benchmark will measure is how fast the conversion to and from
torch.uint8
happens. If you want to see some numbers, please let me know what exactly.cc @vfdev-5 @datumbox @bjuncek