Consider the code, starting with a can model based:
basemod = models.resnet34(pretrained=True)
b_list = list(self.basemod.children())
basemod_new = torch.nn.Sequential(*deepcopy(b_list))
My take on this was that basemod and basemod_new are the same model however basemod_new fails during inference with:
RuntimeError: size mismatch, m1: [2048 x 1], m2: [512 x 1]
Can someone explain what the problem is?