Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vinnamkim opened this issue Apr 12, 2024 · 0 comments

Comments

@vinnamkim
Copy link

馃悰 Describe the bug

Please see this line on the main branch.

return "AVX2" in torch.backends.cpu.get_cpu_capability()

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

need_cast = dtype not in acceptable_dtypes
if need_cast:
image = image.to(dtype=torch.float32)

although this machine can support AVX2.

Versions

torch>=2.1 and torchvision>=0.16.1

@vinnamkim vinnamkim changed the title AVX512 support machine cannot resize uint8 image with BILINEAR interpolation AVX512 support machine cannot resize uint8 image with BILINEAR interpolation as it is Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant