question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mask RCNN ONNX export KeyError: '_new_empty_tensor_op'

See original GitHub issue

System Ubuntu 18.04 Torch 1.4.0 Torchvision 0.5.0 pip installed

I have tried the examples you give in the tutorial: import torch import torchvision model = torchvision.models.detection.maskrcnn_resnet50_fpn(pretrained=True) model.eval() model=model.cuda() test_data = torch.rand(1,3,300,400).cuda() traced_model = torch.jit.trace(model, test_data)

But got this error:

/usr/local/lib/python3.6/dist-packages/torch/tensor.py:461: RuntimeWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won’t change the number of iterations executed (and might lead to errors or silently give incorrect results). ‘incorrect results).’, category=RuntimeWarning) /usr/local/lib/python3.6/dist-packages/torchvision/models/detection/roi_heads.py:392: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor). return torch.tensor(M + 2 * padding).to(torch.float32) / torch.tensor(M).to(torch.float32) /usr/local/lib/python3.6/dist-packages/torch/onnx/symbolic_opset9.py:1951: UserWarning: Exporting aten::index operator of advanced indexing in opset 11 is achieved by combination of multiple ONNX operators, including Reshape, Transpose, Concat, and Gather. If indices include negative values, the exported graph will produce incorrect results. “If indices include negative values, the exported graph will produce incorrect results.”) /usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py:716: UserWarning: ONNX export failed on custom operator torchvision::_new_empty_tensor_op because torch.onnx.symbolic_opset11._new_empty_tensor_op does not exist. Have you registered your symbolic function with torch.onnx.register_custom_op_symbolic(symbolic_name, symbolic_fn)? .format(ns, op_name, opset_version, op_name)) Traceback (most recent call last): File “test.py”, line 9, in <module> torch.onnx.export(model, x, “mask_rcnn.onnx”, opset_version = 11) File “/usr/local/lib/python3.6/dist-packages/torch/onnx/init.py”, line 148, in export strip_doc_string, dynamic_axes, keep_initializers_as_inputs) File “/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py”, line 66, in export dynamic_axes=dynamic_axes, keep_initializers_as_inputs=keep_initializers_as_inputs) File “/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py”, line 416, in _export fixed_batch_size=fixed_batch_size) File “/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py”, line 296, in _model_to_graph fixed_batch_size=fixed_batch_size, params_dict=params_dict) File “/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py”, line 135, in _optimize_graph graph = torch._C._jit_pass_onnx(graph, operator_export_type) File “/usr/local/lib/python3.6/dist-packages/torch/onnx/init.py”, line 179, in _run_symbolic_function return utils._run_symbolic_function(*args, **kwargs) File “/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py”, line 717, in _run_symbolic_function symbolic_fn = sym_registry.get_registered_op(op_name, ns, opset_version) File “/usr/local/lib/python3.6/dist-packages/torch/onnx/symbolic_registry.py”, line 91, in get_registered_op return _registry[(domain, version)][opname] KeyError: ‘_new_empty_tensor_op’

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ResBytecommented, Apr 16, 2020

@fmassa thanks, raised a new issue here #2111 , please have a look.

0reactions
fmassacommented, Apr 15, 2020

@ResByte can you create a new issue? Your error seems unrelated to the original issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

ONNX export failed on ATEn operator upsample bilinear2d
I am trying to export this segmentation model to ONNX. On export I get the error:
Read more >
Tutorial 8: Pytorch to ONNX (Experimental)
List of supported models exportable to ONNX. The Parameters of Non-Maximum Suppression in ONNX Export ... Mask AP of Mask R-CNN drops by...
Read more >
OpenVINO output key error after conversion from ONNX
onnx - Path for generated IR: C:\dev\yolo\weights\ - IR output name: export - Log level: ERROR - Batch: Not specified, inherited from the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found