onnx / tutorials

Tutorials for creating and using ONNX models
Apache License 2.0
3.39k stars 629 forks source link

ScatterND Plugin missing for Torch to ONNX to TRT #208

Closed KelvinCPChiu closed 4 years ago

KelvinCPChiu commented 4 years ago

I am converting a Torch model to TRT. The original model could run but there are too many bounding box proposals. And I tried to add topK and argmax function to remove those low confidence bounding box. the

`


confidence := shape(batch, num_of_proposal)

_ , keep_idx = torch.topk(confidence, k=30, sorted=True, dim=1, largest=True)

oboxes = torch.zeros((batch, 30, 1, 4), dtype=torch.float32) oconfs = torch.zeros((batch, 30, 80), dtype=torch.float32)

for b_idx in range(0, batch, 1): print(keep_idx.shape) oboxes[b_idx, :, :, :] = boxes[b_idx, keep_idx[b_idx], :, :] oconfs[b_idx, :, :] = confs[b_idx, keep_idx[b_idx], :]


`

I think the scatterND plugin missing is resulting from the assignment of the for loop. I would like to ask if there is anyway to bypass/solve this problem ? Thanks.

KelvinCPChiu commented 4 years ago

Move to TensorRT

ygean commented 4 years ago

@KelvinCPChiu Had you solved this problem? I want to know what causes this problem, I think the for loop is not the main reason ....