1 year ago
#314958
Vishak Raj
Converting Pth to onnx - convolution_mode error
I am trying to convert .pth to .onnx file,
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
cnn = nn.Sequential()
cnn.add_module('c1', nn.Conv2d(3, 32, 3, 1, 1))
cnn.add_module('r1', nn.ReLU())
.....
.....
.....
cnn.add_module('l3', nn.Linear(512, 2))
cnn.add_module('ls', nn.LogSoftmax())
self.cnn = cnn
def forward(self, x):
output = self.cnn(x)
return output
sample_batch_image = torch.zeros(64, 3, 224, 224).to(device)
torch.onnx.export(model, sample_batch_image, 'output.onnx', verbose=True, opset_version=13, export_params=True, training=torch.onnx.TrainingMode.EVAL, do_constant_folding=True, input_names = ['cnn.c1'], output_names=['cnn.ls'], dynamic_axes={'cnn.c1': {0: 'batch'}, 'cnn.ls': {0: 'batch'} ,})
this error is came -
RuntimeError: Exporting the operator _convolution_mode to ONNX opset version 13 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub.
How to solve this error, thanks
python
pytorch
onnx
onnxruntime
0 Answers
Your Answer