How to access to a specific layer in a model

hello,
i would like to access many layers of the model and i am struggling to do it.
For now this is what I had done but it does not seem to work and I don’t know how I can do it otherwise (my goal is to access to all layers except for 2 of them).

 for name,param in self.model.named_parameters():
                # ic(name[2])
                if name=='conv_demosaic.1.weight' :
                    # or name['conv_demosaic.1.bias'] or name['conv1_a.0.weight'] or name['conv1_a.0.bias']
                    print('hello')
                    ic(name)
                else:
                    self.model.name.copy_(loaded_state_dict[name])
                    print('yes')
                    ic(name)

Thanks !

I’m not sure what exactly is not working in your code snippet, so could you explain the issue a bit more?