Hi, Thanks for pointing this out. I thought the behavior are identical but it seems like not.
I tried the following simple lines:
#include <torch/torch.h>
struct NetImpl : torch::nn::Module {};
TORCH_MODULE(Net);


int main() {
	Net model;	
	torch::load(model, "net.pt");
	auto in = torch::rand({1, 1, 28, 28});
	auto out = model->forward(in);
    std::cout << in << std::endl;
    std::cout << out << std::endl;
return 0;
}	

the compilation gives following error:
error: ‘struct NetImpl’ has no member named ‘forward’
auto out = model->forward(in);


I’ve to define the NetImpl which I used for training on top of the codes to make it works, it seems like the torch::save will only save the parameters but not the network structure? Am I correct?
If so, is there anyway to save everything in C++ so that I could call it directly?
Thanks again.