NotImplementedError: The following operators are not implemented: ['aten::im2col']

I’m using relay.frontend.from_pytorch to convert pytorch model, but raise error like this:

Traceback (most recent call last):
  File "tune_network_cuda_test.py", line 200, in <module>
    mod, params, input_shape, output_shape = get_local_network("pt", network, batch_size, shape, layout)
  File "tune_network_cuda_test.py", line 97, in get_local_network
    mod, params = relay.frontend.from_pytorch(torch_model, shape_info)
  File "/wen/yincw/open_source/tvm/python/tvm/relay/frontend/pytorch.py", line 3285, in from_pytorch
    converter.report_missing_conversion(op_names)
  File "/wen/yincw/open_source/tvm/python/tvm/relay/frontend/pytorch.py", line 2545, in report_missing_conversion
    raise NotImplementedError(msg)
NotImplementedError: The following operators are not implemented: ['aten::im2col']

and another similar error:

Traceback (most recent call last):
  File "tune_network_cuda_test.py", line 209, in <module>
    mod, params, input_shape, output_shape = get_local_network("pt", network, batch_size, shape, layout)
  File "tune_network_cuda_test.py", line 106, in get_local_network
    mod, params = relay.frontend.from_pytorch(torch_model, shape_info)
  File "/wen/yincw/open_source/tvm/python/tvm/relay/frontend/pytorch.py", line 3285, in from_pytorch
    converter.report_missing_conversion(op_names)
  File "/wen/yincw/open_source/tvm/python/tvm/relay/frontend/pytorch.py", line 2545, in report_missing_conversion
    raise NotImplementedError(msg)
NotImplementedError: The following operators are not implemented: ['aten::grid_sampler']

pytorch=1.3 tvm=0.8 dev0

Could anyone help?

2 Likes

Same question when trying to convert ConvBERT. Any help?

Can you provide your pytorch model?

1 Like

Hello @pzq

As I discussed in previous post, I was able to convert PyTorch model into relay model. I was able to convert squeezeBERT.

However, when I tried to convert convBERT pre-trained model from huggingface,

  model = transformers.ConvBertForSequenceClassification.from_pretrained('YituTech/conv-bert-base', return_dict=False)

It shows the following errors:

NotImplementedError: The following operators are not implemented: [‘aten::im2col’, ‘aten::multiply’]

Thanks for your reply :slight_smile:

Seems like tvm doesn’t support these two operators for now.

  • I think it won’t be hard to add support for aten::multiply.
  • As for aten::im2col, it might take some times. You can first try to replace it by a sequence of equivalent ops in pytorch code.
    :smiley:
1 Like

hi yincw, have you solved this error? " ``` NotImplementedError: The following operators are not implemented: [‘aten::grid_sampler’]

We do support grid_sampler: https://github.com/apache/tvm/blob/1aee5e17287f34b46776c4117ee7e8a796eaaac4/python/tvm/relay/frontend/pytorch.py#L3221

It was added relatively recently. Can you update your TVM?