Input image:0 has unknown dimension shapes during compilation

I’ve downloaded the MobileNet model from here and while trying to compile it for llvm target, I’m getting the below error.

tvmc compile --target llvm mobilenetv2-7.onnx


Check failed: (pval != nullptr) is false: Cannot allocate memory symbolic tensor shape [?, 1080, 1920, 3]

Do I have to save the model after shape inference and then compile?

Hi @harishch4, the error suggests that the model has a dynamic batch size, and you will need to use Relay VM to compile and execute a model with dynamic shapes. I am not an expert on tvmc, but by looking at its code it seems to only support graph executor.

My bad, there is an option to specify input shapes in ttvm command.

–input-shapes INPUT_SHAPES specify non-generic shapes for model to run, format is “input_name:[dim1,dim2,…,dimn] input_name2:[dim1,dim2]”.