How to test sparsity of a NN in PyTorch?

I would like to evaluate a trained NN by looking at the activation distribution of the network’s neurons over a test sample (or batch of samples).

Is there a way to track which / how many neurons were activated in a classification task? And are there other options in PyTorch to evaluate the sparsity of a NN (and compare different NN’s in that regard)?

Thanks!