This commit is contained in:
Glenn Jocher 2019-03-21 15:05:20 +02:00
parent a3067e7978
commit a024286ec1
1 changed files with 1 additions and 1 deletions

View File

@ -37,7 +37,7 @@ def model_info(model):
# Plots a line-by-line description of a PyTorch model # Plots a line-by-line description of a PyTorch model
n_p = sum(x.numel() for x in model.parameters()) # number parameters n_p = sum(x.numel() for x in model.parameters()) # number parameters
n_g = sum(x.numel() for x in model.parameters() if x.requires_grad) # number gradients n_g = sum(x.numel() for x in model.parameters() if x.requires_grad) # number gradients
print('\n%5s %38s %9s %12s %20s %12s %12s' % ('layer', 'name', 'gradient', 'parameters', 'shape', 'mu', 'sigma')) print('\n%5s %40s %9s %12s %20s %10s %10s' % ('layer', 'name', 'gradient', 'parameters', 'shape', 'mu', 'sigma'))
for i, (name, p) in enumerate(model.named_parameters()): for i, (name, p) in enumerate(model.named_parameters()):
name = name.replace('module_list.', '') name = name.replace('module_list.', '')
print('%5g %40s %9s %12g %20s %10.3g %10.3g' % ( print('%5g %40s %9s %12g %20s %10.3g %10.3g' % (