YueLiao / CDN

Code for "Mining the Benefits of Two-stage and One-stage HOI Detection"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError: cannot import name '_new_empty_tensor' from 'torchvision.ops'

Dawn-LX opened this issue · comments

A small tip, in case the future researcher have the similar issue.

my torchvision.__version__ is "0.12.0+cu113"
and this line

if float(torchvision.__version__[:3]) < 0.7:

should be modified as:

# if float(torchvision.__version__[:3]) < 0.7:
if int(torchvision.__version__.split('.')[1]) < 7:  # my torchvision.__version__ is "0.12.0+cu113"
    from torchvision.ops import _new_empty_tensor
    from torchvision.ops.misc import _output_size

Yes, that's right.