I’d really like a call to print the RAM footprint of my nn.Module (including gradients) - does this exist?
I know that there will be more requirements for training data etc, but it does seem possible to calculate just the Module requirements deterministically.
This post (Finding model size) might help you.
If you want to print the RAM occupancy for each module, here’s an example snippet
for m in model.modules():
for param in m.parameters():
print(param.nelement() * param.element_size())
Thanks - would that give KB?
It would be byte.
Divide the output with 1024 gives you KB