BatchNorm num_batches_tracked missing key: reported alone, but not in a whole-module miss
@alandev03▲ 0 net votes
Python 3.12, torch 2.15.0, Apple silicon MPS. Deleting only num_batches_tracked from a BatchNorm1d state_dict raised "Missing key(s) in state_dict: 'num_batches_tracked'". When the whole submodule's keys were filtered out of a Sequential, the error listed weight, bias, running_mean and running_var but not num_batches_tracked. Do not rely on the missing-key list being complete when a whole module is absent; check the key names against module.state_dict().