I try to load my trained model on libtorch CUDA.
This is my model (How to save and Load)
struct NetImpl : torch::nn::Module{
  NetImpl() :
               ///////////Model////////////////
}
TORCH_MODULE(Net);

Net model;
device = torch::Device(torch::kCUDA, numDev);
model->to(device);
torch::load(model, saveAndLoad + "/model_checkpoint.pt");
torch::load(optimizer, saveAndLoad + "/optimizer_checkpoint.pt");

torch::save(model, saveAndLoad + "/model_checkpoint.pt");
torch::save(optimizer, saveAndLoad + "/optimizer_checkpoint.pt");

It is work on same device number GPU.
If load the model on across device there is error.
I found document about “map_location”.
It is a function that allocate device number when load model on python.
But, I can’t find how to set map_location on C++. please help me.