You could also go for :
zeros += param.numel() - param.nonzero().size(0)
I am not sure which one is the fastest, but I find this way a bit clearer.
You could also go for :
zeros += param.numel() - param.nonzero().size(0)
I am not sure which one is the fastest, but I find this way a bit clearer.