Vpi pythorch example crash on ORIN

Hi,

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!

Hi,

Thanks for reporting this issue.

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

Thanks

Hi,

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

...
import torch
import vpi
import numpy as np
...

Thanks.

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

Hi,

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

Hi,

Sorry to keep you waiting.

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

Thanks.