Skip to content

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

@vinnamkim

Description

@vinnamkim

🐛 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions