Is there a simple function that I can call to return how many learnable parameters there are in my model? I want to compare two different architectures and would like to know exactly how many parameters each model has.
Thanks for your help
Is there a simple function that I can call to return how many learnable parameters there are in my model? I want to compare two different architectures and would like to know exactly how many parameters each model has.
Thanks for your help
The newly implemented model_summary
function (in callbacks.hooks) gives you that. It doesn’t work on all models yet though.
Thanks, I will give it a try
def calc_net_weight_count(net):
net.train()
net_params = filter(lambda p: p.requires_grad, net.parameters())
weight_count = 0
for param in net_params:
weight_count += np.prod(param.size())
return weight_count
for a learner just call the function on net.model (or whatever your Learner is called).
This works perfect!
Thanks