Using libtorch to implement DQN

I need to implement DQN algorithm using libtorch. But it seems that libtorch didn’t provide
the method of copying the parameters from the training network to the target network, which is necessary for DQN.

The corresponding Python code is like this:

 def update_target_q_network(self):
        self.target_model.load_state_dict(self.model.state_dict())

Are there any practical solutions to this question?

try this:

for (size_t i = 0; i < target_model.parameters().size(); i++)
{
        target_model.parameters()[i].copy_(model->parameters()[i]);
}