mit-han-lab / torchquantum

A PyTorch-based framework for Quantum Classical Simulation, Quantum Machine Learning, Quantum Neural Networks, Parameterized Quantum Circuits with support for easy deployments on real quantum computers.
https://torchquantum.org
MIT License
1.33k stars 203 forks source link

Quantum classical hybrid model cannot load parameters from dictionary #210

Open zeng1in opened 1 year ago

zeng1in commented 1 year ago

When my model is quantum classical hybrid model, I can use I use

torch.save(model.state_dict(), "model_dict.pt")
model2 = QFCModel()
model2.load_state_dict(torch.load("model_dict.pt"))

RuntimeError: Error (s) in loading state Dict for QFCModel: Unexpected key (s) in state Dict: "linear. weight", "linear. bias"