intel-extension-for-pytorch
intel-extension-for-pytorch copied to clipboard
Torchvision functions are broken
Using the docker image https://github.com/intel/intel-extension-for-pytorch/tree/v1.13.10%2Bxpu/docker
Reading an image gives an error
import torch
from torchvision.io import read_image
import intel_extension_for_pytorch as ipex
print("reading")
image = read_image("a.png")
print("done")
root@3ddc5256fb95:/workspace# python3 ./a.py
/usr/local/lib/python3.10/dist-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension:
warn(f"Failed to load image Python extension: {e}")
reading
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/torch/_ops.py", line 501, in __getattr__
op, overload_names = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator image::read_file
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/workspace/./a.py", line 12, in <module>
image = read_image("a.png")
File "/usr/local/lib/python3.10/dist-packages/torchvision/io/image.py", line 253, in read_image
data = read_file(path)
File "/usr/local/lib/python3.10/dist-packages/torchvision/io/image.py", line 47, in read_file
data = torch.ops.image.read_file(path)
File "/usr/local/lib/python3.10/dist-packages/torch/_ops.py", line 505, in __getattr__
raise AttributeError(
AttributeError: '_OpNamespace' 'image' object has no attribute 'read_file'