vision icon indicating copy to clipboard operation
vision copied to clipboard

AVX512 support machine cannot resize uint8 image with BILINEAR interpolation as it is

Open vinnamkim opened this issue 1 year ago • 0 comments

🐛 Describe the bug

Please see this line on the main branch. https://github.com/pytorch/vision/blob/5181a854d8b127cf465cd22a67c1b5aaf6ccae05/torchvision/transforms/v2/functional/_geometry.py#L200 It decides whether the image resize can be done for uint8 datatype with native CPU.

However, the return type of torch.backends.cpu.get_cpu_capability() is not a kind of set or sequence of strs. It returns str, https://pytorch.org/docs/2.2/backends.html#torch.backends.cpu.get_cpu_capability. Therefore, on a AVX512 support machine, torch.backends.cpu.get_cpu_capability() returns "AVX512" and it leads to float32 casting at https://github.com/pytorch/vision/blob/5181a854d8b127cf465cd22a67c1b5aaf6ccae05/torchvision/transforms/v2/functional/_geometry.py#L256-L258 although this machine can support AVX2.

Versions

torch>=2.1 and torchvision>=0.16.1

vinnamkim avatar Apr 12 '24 03:04 vinnamkim