onnx / onnx-tensorrt

ONNX-TensorRT: TensorRT backend for ONNX
Apache License 2.0
2.96k stars 546 forks source link

While parsing node number 26 [Transpose -> "96"]: #87

Closed niuxiaozhang closed 3 years ago

niuxiaozhang commented 5 years ago

image

niuxiaozhang commented 5 years ago

Input filename: /home/hadoop/projects/onnx_model/license_plate_recognition.onnx ONNX IR version: 0.0.3 Opset version: 9 Producer name: pytorch Producer version: 0.4 Domain:
Model version: 0 Doc string:

While parsing node number 26 [Transpose -> "96"]: ERROR: /home/erisuser/p4sw/sw/gpgpu/MachineLearning/DIT/release/5.0/parsers/onnxOpenSource/builtin_op_importers.cpp:1660 In function importTranspose: [8] Assertion failed: perm.order[BATCH_DIM] == BATCH_DIM ERROR: failed to parse onnx file

zhenming33 commented 5 years ago

this may be caused by transpose batch dimension

OverrideSkywalker commented 4 years ago

老哥问题解决了吗

persuelx commented 4 years ago

Have you solved it?

feitiandemiaomi commented 4 years ago

@niuxiaozhang @persuelx @zhenming33 I meet the same problem ,how did you solve it?

persuelx commented 4 years ago

@feitiandemiaomi sorry, I have not solverd it

zhenming33 commented 4 years ago

@feitiandemiaomi @persuelx in my case, i change shape from batch_size channel w to w batch_size channel, don't transpose batch_size dimension in model

feitiandemiaomi commented 4 years ago

@zhenming33 你是对的,我看了源码,tensorrt确实不允许batch_size的维度发生变化,像我的代码out = out.permute(3, 0, 1, 2).view(out.size(3), out.size(0), -1) 改成out = out.permute(0, 3, 2, 1).view(out.size(3), out.size(0), -1) 即可以解决上述报错

feitiandemiaomi commented 4 years ago

@persuelx 可以借鉴

persuelx commented 4 years ago

@feitiandemiaomi @zhenming33 thank u ,I have done it successfully

feitiandemiaomi commented 4 years ago

@persuelx can you paste the error code ,because I find the new problem. 图片

persuelx commented 4 years ago

My mistake is the same as the first floor(niuxiaozhang),your mistake is not the same as mine。

feitiandemiaomi commented 4 years ago

@persuelx Does your code contain view or reshape , I want to verify my error

persuelx commented 4 years ago

en

feitiandemiaomi commented 4 years ago

def forward(self, x): out = self.features(x) out = self.avgpool(out) out = out.permute(3, 0, 1, 2).view(out.size(3), out.size(0), -1) out = self.classifier(out) out = F.log_softmax(out, dim=2) return out Here are all the operations on shapes: [1, 3, 32, 200] ->[1, 384, 4, 25] ->[1, 384, 1, 25] ->[25, 1, 384] ->[25, 1, 5990]

feitiandemiaomi commented 4 years ago

@persuelx I can determine thar the error is view op. can you share forward code?

kevinch-nv commented 4 years ago

Has anyone tried to repro this with later versions of TensorRT?

kevinch-nv commented 3 years ago

Closing due to inactivity - if this can be reproduced on the latest version of onnx-tensorrt feel free to open a new issue.