tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Segmentation fault while trying to run "torch.onnx.export"

Open zhichao-li opened this issue 6 years ago • 1 comments

I was running into segmentation fault issue while trying to export onnx model. and the component we use is Python 3.5.4 , torch-0.4.1, Ubuntu 14.04

>>> from torch.autograd import Variable
>>> import torch.onnx
>>> import torchvision
>>> 
>>> # Standard ImageNet input - 3 channels, 224x224,
... # values don't matter as we care about network structure.
... # But they can also be real inputs.
... dummy_input = Variable(torch.randn(1, 3, 224, 224))
>>> # Obtain your model, it can be also constructed in your script explicitly
... model = torchvision.models.alexnet(pretrained=True)
>>> # Invoke export
... 
>>> torch.onnx.export(model, dummy_input, "alexnet.onnx")
Segmentation fault (core dumped)


zhichao-li avatar Jul 30 '18 07:07 zhichao-li

I guess, that's because of the C++ ABI issue. Try to install the pytorch and onnx both from source.

houseroad avatar Aug 28 '18 00:08 houseroad