-
Notifications
You must be signed in to change notification settings - Fork 545
Attribute not found: height_scale #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@houseroad Do we have height_scale in UpSample in ONNX? |
In the current ONNX operator specs, Upsample takes the scales as an input, no longer as an an attribute. See https://github.com/onnx/onnx/blob/master/docs/Operators.md#upsample |
You are right. The onnx model that pytorch exports matches the current specs. But why I can't convert it to the tensorrt engine by |
@m7thon Thanks for pointing this out. We can probably handle this like what we did for onnx-tensorrt/builtin_op_importers.cpp Lines 1361 to 1379 in 2abb940
@houseroad Could you help track since which opset version did we change the input of upsample? |
It's changed in opset 9, here is the change: onnx/onnx#1467 |
@shocho3858 Could you try patch from #80 and see if this works for you? |
yeah, It's ok now. thx. |
How can i fix this issu? I use Python 3.5 and i want to convert the model from pytorch to onnx and then tensorrt |
same issue, I use tensorrt 5 and look like the problem lies in backend.py line 80 trt.OnnxParser |
I have the same issue. |
@xiongzhangdavid @alexbuyval @maiminh1996 I think I have find how to fix this bug,actually not by me,is nvidia's engineer ,at this example retina-example.
We need to override upsample_nearest2d symbol so that tensorRT5.0 can parsing the upsample operator.
|
mark |
Uh oh!
There was an error while loading. Please reload this page.
The onnx model file is exported from a pytorch model by
torch.onnx.export
. There is an error when I then useonnx2trt
to do the conversion.``
Input filename: model.onnx
ONNX IR version: 0.0.3
Opset version: 9
Producer name: pytorch
Producer version: 0.4
Domain:
Model version: 0
Doc string:
Parsing model
terminate called after throwing an instance of 'std::out_of_range'
what(): Attribute not found: height_scale
Aborted
``
I found this is due to
torch.nn.Upsample(scale_factor=4, mode='nearest')
.In face, the torch's onnx exporter transform an Upsample operation like this:
``
%244 : Dynamic = onnx::Constantvalue= 1 1 4 4 [ CPUFloatType{4} ], scope: East/Upsample[unpool1]
%245 : Float(1, 512, 100, 100) = onnx::Upsample[mode="nearest"](%243, %244), scope: East/Upsample[unpool1]
return (%245);
``
I guess the
height_scale
andwidth_scale
hide inonnx:Constant
and there is no scale attributes inonnx:Upsample
. But in your code,height_scale
andwidth_scale
are required.I am using pytorch 0.4.1 and tensorrt 5.0.2.6.
Any suggestions to turn it out?
The text was updated successfully, but these errors were encountered: