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.

Error ONNX Export failed, Hardtanh not supported

See original GitHub issue

I tried to export a PyTorch model to ONNX and got this warning and error :

UserWarning: ONNX export failed on ATen operator hardtanh because torch.onnx.symbolic.hardtanh does not exist RuntimeError: ONNX export failed: Couldn't export operator aten::hardtanh

So after some researches, I understood that PyTorch can’t export the operator Hardtanh. I tried to follow the tutorial to add export support but it seems like Hardtanh is not a standardized operator in ONNX. For this case, the tutorial says I have to add it to ONNX. How can I do that ? Is it possible to achieve this or should I wait for this operator to be supported or find another way to convert my model ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
houseroadcommented, May 17, 2018

You can propose to introduce HardTanh to ONNX, I think it’s common enough to be introduced.

1reaction
Ac2zoomcommented, Jul 5, 2018

https://github.com/pytorch/pytorch/pull/8804. However, Hardtanh can also be equivalently expressed by Clip.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NonImplementedError on using torch.onnx.export
The neural network has 2 inputs, one hidden layer with 5 neurons and a scalar output. Here's the code I'm working with: import...
Read more >
ONNX export failed on unsafe_chunk - PyTorch Forums
I was trying to export the Tacotron2 model provided by torchaudio: import torch import torchaudio import onnx bundle = torchaudio.pipelines.
Read more >
torch.onnx — PyTorch master documentation
from torch.autograd import Variable import torch.onnx import torchvision ... The export fails because PyTorch does not support exporting elu operator.
Read more >
Python API: torch/onnx/symbolic.py Source File - Caffe2
78 raise RuntimeError("ONNX symbolic expected a constant value in the ... export failed on " + op + " because " + msg...
Read more >
torch.onnx — PyTorch master documentation
Example: End-to-end AlexNet from PyTorch to ONNX. Tracing vs Scripting ... The export fails because PyTorch does not support exporting elu operator.
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