Hello, I have modified the resnet_cbam successfully. And the loop should be:
for k in modified_resnet.state_dict():
if k in vanilla_resnet.state_dict():
modified_resnet.state_dict[k] = vanilla_resnet.state_dict[k]