Vpi pythorch example crash on ORIN


I wanted to try the pytorch integration with vpi example : /opt/nvidia/vpi2/samples/16-vpi_pytorch/main.py

However when I run it I get the following error:

free(): invalid pointer
Aborted (core dumped)

After a quick investigation, it turns out that the script crash at the second import :

import vpi
import torch # crash here

Any idea about what could be wrong and how to solve it?

Thank you!


Thanks for reporting this issue.

Confirmed that we can see the same behavior internally.
Will check it further and update more information later.



Please change the import order as follow, and test it again.

import torch
import vpi
import numpy as np


Thank you. When changing the import order, it turns out pytorch is not installed. I installed it following this tutorial:

Note that the indicated link for the wheel is wrong, but it was easy to fix.

Now it seems to work, but I have the following message when running the script:

vpi_pytorch.py:51: UserWarning: The given NumPy array is not writable, and PyTorch does not support non-writable tensors. This means writing to this tensor will result in undefined behavior. You may want to copy the array to protect its data or make it writable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at …/torch/csrc/utils/tensor_numpy.cpp:199.)

Is it expected?
And the script is really slow: on a 1900x1200 image, with the ORIN in MAXN mode, it takes around 5s (import times have been removed) to simply blur it and do a basic math operation.

Do you have the same behavior on your side?

Thank you


Thanks for this information.

We are double-confirming this with our internal team.
Will share more information with you later.

Hi, have you succeed in reproducing this issue?

Thank you


Sorry to keep you waiting.

Our internal is still checking this.
Will share more information with you once we got feedback.



Did you had the opportunity to investigate this suspicious behavior?

In the meantime, maybe you can answer the question I wanted to solve: I wanted to check if vpi convolutions are faster than pytorch convolutions. Do you know if it is the case? Or is it the same?
And is there a way in vpi to perform basic arithmetic operations ( + - * / ) on images like adding 2 images using GPU? And if yes how does it compare to torch implementations?

Thank you !


You can find the performance table of VPI below:

VPI doesn’t support element-wise operations like + or -.
But we do have another library called TensorRT that can give you a better performance compared to PyTorch.

Have you checked it before?


I didn’t know TensorRT, it seems really interesting. I will test it. Thank you !


Below is some sample for your reference as well:


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