How to traverse all the model parametes (including mean/var in BN) in a single run?

I wanna get all the parameters in some model (maybe a complext model, like Inception ResNet).
But I cannot get mean/var parameters in BatchNorm layers by this way:

params = list(net.parameters())

so, any suggestions here? thx.

Mean and var in BN are not parameters that are optimized, so they’re not returned there. But they are part of the model state so you could use model.state_dict().values().

thanks, it works well.:slight_smile: