vision: Failed to register operator torchvision::_new_empty_tensor_op

Trying to import import torchvision results in exception:

Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/usr/local/lib/python3.6/dist-packages/torchvision/init.py”, line 3, in <module> from torchvision import models File “/usr/local/lib/python3.6/dist-packages/torchvision/models/init.py”, line 12, in <module> from . import detection File “/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/init.py”, line 1, in <module> from .faster_rcnn import * File “/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/faster_rcnn.py”, line 7, in <module> from torchvision.ops import misc as misc_nn_ops File “/usr/local/lib/python3.6/dist-packages/torchvision/ops/init.py”, line 13, in <module> _register_custom_op() File “/usr/local/lib/python3.6/dist-packages/torchvision/ops/_register_onnx_ops.py”, line 49, in _register_custom_op register_custom_op_symbolic(‘torchvision::_new_empty_tensor_op’, new_empty_tensor_op, _onnx_opset_version) File “/usr/local/lib/python3.6/dist-packages/torch/onnx/init.py”, line 200, in register_custom_op_symbolic return utils.register_custom_op_symbolic(symbolic_name, symbolic_fn, opset_version) File “/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py”, line 793, in register_custom_op_symbolic .format(symbolic_name)) RuntimeError: Failed to register operator torchvision::_new_empty_tensor_op. The symbolic name must match the format Domain::Name, and sould start with a letter and contain only alphanumerical characters

Torchvision version (built from source): 0.6.0a0+28b7f8a PyTorch version (built from source): 1.4.0a0+7f73f1d

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 23 (9 by maintainers)

Most upvoted comments

Hi,

You need a newer version of PyTorch to be able to compile latest torchvision (I had myself the same issue yesterday and an upgrade of PyTorch fixed it)

If you want to use torchvision nightly, you need to use PyTorch nightly.

If you want to use a PyTorch from a release (say 1.4.0), you should use a torchvision from a matching release as well (in this case, 0.5.0)

5ac5ab9ee83837faa81e7a104f5bd86b330c9fe6 seems to have introduced _new_empty_tensor_op which is the identifier that torch is complaining about. Rolling back torchvision to the parent commit, 40c99eae6d5cfa9f58bdf411242ea15b848eafb5, causes the import to succeed, and I was successful in running an image recognition demo.

Given how intertwined torchvision is with PyTorch, might not be a bad idea to enforce the torch version via requirements.txt, have a version compatibility chart documented (if it isn’t already, didn’t spot one), or base the version number of torchvision on its compatible version of PyTorch (assuming they are released in lockstep).

We should have something similar to torchtext’s dependency matrix for all the domain libraries. https://github.com/pytorch/text#installation

torchvision 0.6.0 is expected to work with PyTorch 1.5.0, and we don’t guarantee that it will work with earlier versions of PyTorch

Given how intertwined torchvision is with PyTorch, might not be a bad idea to enforce the torch version via requirements.txt, have a version compatibility chart documented (if it isn’t already, didn’t spot one), or base the version number of torchvision on its compatible version of PyTorch (assuming they are released in lockstep).

I resolved this with pip install --upgrade torch torchvision

Hi,

torchvision 0.6.0 is expected to work with PyTorch 1.5.0, and we don’t guarantee that it will work with earlier versions of PyTorch

Seeing this error with Torchvision 0.6.0 (built from source) on ppc64le (CUDA 10.0) and x86-64 (CUDA 10.2) with PyTorch 1.4.0 (built from source), python 3.6.9 on Ubuntu 18.04. I’ll attempt to downgrade TorchVision to 0.5.0 since ppc64le is currently broken with PyTorch 1.5.0.

UPDATE: Downgrading cleared this issue in x86-64, testing ppc64le UPDATE2: Downgrade cleared it in ppc64le as well

Hi,

You need a newer version of PyTorch to be able to compile latest torchvision (I had myself the same issue yesterday and an upgrade of PyTorch fixed it)

By newer you mean the nightly version? He already uses 1.4 (And I got the same problem with v1.4.0)

Which torchvision should we use with pytorch v1.4.0?