Rate this Page

Template Function torch::load(std::vector<torch::Tensor>&, LoadFromArgs&&…)#

Function Documentation#

template<typename ...LoadFromArgs>
void torch::load(std::vector<torch::Tensor> &tensor_vec, LoadFromArgs&&... args)#

Deserializes the given tensor_vec of type std::vector<torch::Tensor>.

To perform the serialization, a serialize::InputArchive is constructed, and all arguments after the value are forwarded to its load_from method. For example, you can pass a filename, or an istream.

std::vector<torch::Tensor> tensor_vec;
torch::load(tensor_vec, "my_tensor_vec.pt");

std::vector<torch::Tensor> tensor_vec;
std::istringstream stream("...");
torch::load(tensor_vec, stream);