Closed williamyang1991 closed 1 year ago
Thanks for letting me know! I think I accidentally deleted it while refactoring the code. I added this function again :)
My original implementation looks like this:
def count_parameters(module):
assert isinstance(module, nn.Module)
num_params = 0
for p in module.parameters():
if p.requires_grad:
num_params += p.numel()
return num_params
It works same as your suggestion, so you can use your own implementation.
I got an error here https://github.com/kunheek/style-aware-discriminator/blob/a6c38f5525e4f2eef3cd4f5956066b2e68e8b60c/mylib/base_model.py#L39
No function of count_parameters() is found
I find a similar function on the web and add it to torch_utils.py, then I can successfully run the code.