extend equalize to all integer and floating dtypes #6851
Merged
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.
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