I am trying to use transfer learning. I want to freeze the parameters of the model apart from the batch norm layers. I am using the below code but getting too many values error.
for name,param in model_transfer.parameters():
    if ("bn" not in name):
        param.requires_grad = False


Error:
ValueError                                Traceback (most recent call last)
 in 
----> 1 for name,param in model_transfer.parameters():
      2     if ("bn" not in name):
      3         param.requires_grad = False
      4 
      5 

ValueError: too many values to unpack (expected 2)


How to resolve it?