I want to compile an ONNX model with a NonMaxSuppression layer in TVM.
To compile this model without using relay VM, I need to make all layers static shape.
By setting freeze_params=True, all layers except vision.all_class_non_max_suppression() becomes static shape.
relay.frontend.from_onnx converts ONNX::NonMaxSuppression layer to tvm.relay.vision.all_class_non_max_suppression.
Currently, the output of vision.all_class_non_max_suppression is in dynamic shape because the number of bboxes is determined dynamically.
In vision.non_max_suppression, the output can be made static shape by setting return_indices=False.
Similarly, is it possible to extend the implementation of all_class_non_max_suppression to make the output static shape?
More precisely, the question is whether it is possible to make the output of strided_slice inserted after vision.all_class_non_max_suppression() a static shape when ONNX NonMaxSuppression is converted to relayIR.
No, NMS op in ONNX returns dynamic shape, so we can’t simply drop strided_slice there. The output of all_class_non_max_suppression itself is of static shape.
I was looking to make it a static shape because I thought that was causing my relay.build to break, but after hardcoding the stride in order to get rid of the dynamic stride op, I was still having the issue, so I guess I am still having another problem. I will create a new post with that problem.