Skip to content
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

Can't infer maskrcnn onnx format due to dynamic shape? #8

Open
PengYoun9 opened this issue Oct 28, 2024 · 0 comments
Open

Can't infer maskrcnn onnx format due to dynamic shape? #8

PengYoun9 opened this issue Oct 28, 2024 · 0 comments

Comments

@PengYoun9
Copy link

PengYoun9 commented Oct 28, 2024

Hello, Masahi. I'm very glad to see this repo.

I successfully used the VM to complete the inference of Mask R-CNN on the CUDA backend. However, when I tried to convert the Mask R-CNN in Torch format to ONNX format, I found that the VM seems unable to handle the dynamic shape issues introduced by the NonZero operator (it looks like it).

From the perspective of Relay IR analysis, after the NonZero operation, the model's output shape becomes: ?

%418 = argwhere(%417) /* ty=Tensor[(?, 1), int32] span=/model/rpn/NonZero:0:0 */;

which leads to a series of shape inference problems. For example, when choosing the implementation for subsequent convolution operations, it is unable to select the appropriate implementation for correct computation due to the dynamic input shape. eg:
Cannot find config for target=cuda -keys=cuda,gpu -arch=sm_86 -libs=cublas -max_num_threads=1024 -thread_warp_size=32, workload=('conv2d_nchw.cuda', ('TENSOR', (any_dim, any_dim, any_dim, any_dim), 'float32'), ('TENSOR', (256, any_dim, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'float32'). A fallback configuration is used, which may bring great performance regression.

However, it seems that the PyTorch frontend does not have this issue.

I would like to hear your thoughts and suggestions on this problem. Looking forward to your reply~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant