How would I do load_state_dict in C++?

Hello!
I would like to clone my network at every x-iteration. This is being done in python with the following code:
target_net.load_state_dict(policy_net.state_dict()) however, these functions do not seem to exist in C++?

Code from:
Reinforcement Learning (DQN) Tutorial

So what I am looking for is the equivalent to target_net.load_state_dict(policy_net.state_dict()) in C++

I think the philosophy is to compile your model using PyTorch’s JIT and then loading it in CPP.

But, you can always redesign your architecture in CPP using the torch::nn namespace and then load a text-serialized version of the weights.

Maybe I should have been more clear, both models are in C++. I do not have a model in python. That code-snippet is from Reinforcement Learning (DQN) Tutorial. and I would like to do the equivalent in C++

The current implementation of load_state_dict is in Python, and basically it parses the weights dictionary and copies them into the model’s parameters.

So I guess you’ll need to do the same in CPP.