I wonder how to create tensor from gstreamer data?
torch::from_blob if you/gstreamer keep owning the memory for as long as the Tensor exists or allocating a tensor and passing the memory pointer (
t.data_ptr) to gstreamer. There also is a variant where PyTorch calls a deleter function when it doesn’t need the memory anymore (this is at the heart of the DLPack mechanism).
I usually recommend the latter if you have the option to avoid having to track memory.