Assuming you would like to pass this list to an optimizer, this approach should work:
bn_paras = []
for layer in resnet.modules():
   if isinstance(layer,torch.nn.modules.batchnorm.BatchNorm2d): 
       bn_paras.extend(list(layer.parameters()))
       
optimizer = torch.optim.SGD(bn_paras, lr=1.)