I used this but give me this error:(Error(s) in loading state_dict for ConvNet:
size mismatch for layer1.0.weight: copying a param with shape torch.Size([32, 1, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([2, 1, 3, 3, 3]).
size mismatch for layer1.0.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([2]).)
model = ConvNet(2,64,3,3,300,20)
optimizer =torch.optim.Adam(model.parameters(), lr=LR)
TargetWholev2=[]
for Iteration1 in range(9):
Path1=root_dir2+’/Fold_’+str(FoldNum)+‘NumDarw=’+str(NumDraw)+‘Iteration’+str(Iteration1+1)+’.pth’
checkpoint = torch.load(Path1)
            checkpoint = torch.load(Path1,map_location=torch.device('cpu'))

            model.load_state_dict(torch.load(Path1,map_location=torch.device('cpu'))['model_state_dict'])


            optimizer.load_state_dict(torch.load(Path1,map_location=torch.device('cpu'))['optimizer_state_dict'])