Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7371fea

Browse files
authored
fix state_dict's reference to include registered buffers
1 parent 0bda28d commit 7371fea

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

beginner_source/saving_loading_models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
# (accessed with ``model.parameters()``). A *state_dict* is simply a
5858
# Python dictionary object that maps each layer to its parameter tensor.
5959
# Note that only layers with learnable parameters (convolutional layers,
60-
# linear layers, etc.) have entries in the model’s *state_dict*. Optimizer
60+
# linear layers, etc.) and registered buffers (batchnorm's running_mean)
61+
# have entries in the model’s *state_dict*. Optimizer
6162
# objects (``torch.optim``) also have a *state_dict*, which contains
6263
# information about the optimizer’s state, as well as the hyperparameters
6364
# used.

0 commit comments

Comments
 (0)