lifeblack:

Yes the code that you sent, is correct. But the code that I wrote, still have faced that error. I change the require_grad of last layer and it fixed…


Strange though. Do you use the latest version of pytorch?
I use torch 1.6.0 and do not observe this error while running your code.



 lifeblack:

@InnovArul Could you please tell the purpose of this part?


It is just to make sure that the conv layer’s weights are different between the models. They do not interfere in model forward or model design.