Closed
Description
🚀 Feature
The current implementation of the equalize transformation is not vectorized. It processes each channel of each image of the batch using a for loop. This is done because the method uses internally the torch.histc
which currently can't produce a histogram across a dimension.
vision/torchvision/transforms/functional_tensor.py
Lines 1281 to 1282 in 83171d6
@fmassa proposed a workaround that trades memory for speed and achieves vectorization. Check #3123 (comment) for the overview/context of the proposal.
To adopt his, a few addtional changes need to be made:
- The rest of the
_scale_channel()
needs to be adapted to vectorize the remaining operations. - The
_equalize_single_image()
needs to be removed and the stacking operation inequalize()
need to be adapted.