warmspringwinds / pytorch-cpp

Pytorch C++ Library
369 stars 68 forks source link

Conversion from float std::vector to Aten Tensor and vice versa? #13

Open kirill-pinigin opened 6 years ago

kirill-pinigin commented 6 years ago

Conversion from float std::vector to Aten Tensor and vice versa?

warmspringwinds commented 6 years ago

@kirill-pinigin Providing the .data() output of a vector to a tensorFromBlob() function should work. Not really relevant but close example: https://github.com/warmspringwinds/pytorch-cpp/blob/master/examples/read_allocated_gpu_memory.cpp#L64