Difference between --sparsity=enable and --sparcity=disable in .trtexec utility

We are trying to get the throughput of sparse and dense models. We have a doubt regarding a flag in .trtexec utility. Doubts are as below.

  1. What is the meaning of the dense model?
  2. When we use --sparsity=disable, do we get a dense model or sparse model?
  3. When we convert a .onnx model to .trt model using .trtexec tool, does it by default create a sparse model?
  4. What is the difference between --sparsity=enable and --sparcity=disable in .trtexec utility? (I am getting the same results with both of the options applied on the same model separately)


Please check the below document of trtexec first.


Thank you for the response. We are getting the below results after using the flag --sparsity=enable and --sparsity=disable.

Can you please help us understand the reason why we are getting almost the same results with both of the options?
To convert batch latency to throughput, we are using this formula.
Formula → (1/Latency)1000Batch_size


May I know how you prune the ResNet 101 model into the sparse version?
Could you also share the file size of the dense model and the sparse model?

Please noted with --sparsity=enable, TensorRT only uses the sparse feature when the weights have the right sparsity pattern.

If you run it with the --sparsity=force flag, TensorRT enables sparse tactics in the builder and force-overwrite the weights to have a sparsity pattern.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.