Hi @cj0741,
I must admit I am no expert in Pytorch for C++. However, I do not know of a function in the API that does this conversion automatically.
The only way I am aware of  to access the data from a Tensor object, which could be used to build a C++ vector manually, is as follows:
auto sample_data = *(sample.data_ptr<double>())

Where sample is a Tensor object, assuming that it is a tensor of type double.
Be careful though. If you want to, for example, use backpropagation on a neural network, the values that you create must be linked to Tensor objects. If you directly take the data from a Tensor object, and somehow manipulate it, the autograd graph will not keep track of those operations. Again, I admit I am no expert, but that is how I have understood it so far. The documentation here is probably clearer in explaining this: https://pytorch.org/tutorials/beginner/blitz/autograd_tutorial.html.
Feel free to post this as its own question on the forum, perhaps someone else knows. I would also be interested in knowing if such a function exists.