seniorPyTorch
What is the difference between state_dict and model.parameters() in PyTorch?
Updated May 17, 2026
Short answer
state_dict stores named tensors of model weights, while parameters() returns iterable parameter objects for optimization.
Deep explanation
state_dict is a Python dictionary mapping parameter/buffer names to tensors, making it ideal for saving/loading models. parameters() returns raw parameter tensors used by optimizers. Buffers like running_mean in BatchNorm are included in state_dict but not parameters().
Unlock with a Pro subscription to view this section.
View pricingReal-world example
No real-world example available yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProCommon mistakes
No common mistakes listed yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProFollow-up questions
No follow-up questions available yet.
Unlock with a Pro subscription to view this section.
Upgrade to Pro