Weight decay only for weights of nn.Linear and nn.Conv*

Your approach seems reasonable. Iterating all named parameter of the model might be a bit easier:

model = models.resnet152()

decay = dict()
no_decay = dict()
for name, m in model.named_parameters():
    print('checking {}'.format(name))
    if 'weight' in name:
        decay[name] = param
    else:
        no_decay[name] = param
    
print(decay.keys())
print(no_decay.keys())