Hi,
When you call from_blob, you tell the Tensor to use this content in memory but the Tensor does not “own” the memory!
So it is your responsability to make sure that this memory is kept allocated as long as the Tensor lives.
In your case, when you exit the scope, the std::vector is destructed and the memory is freed, hence later access to the Tensor with segfault.
Note that resizing the std::vector could also lead to similar issues if the underlying storage is re-allocated.