and I saved it in this way:
Path=root_dir1+’/Fold_’+str(FoldNum)+‘NumDarw=’+str(NumDraw)+‘Iteration’+str(Iteration)+".pth"
checkpoint = {‘model_state_dict’: model.state_dict(),‘optimizer_state_dict’: optimizer.state_dict()}
# print(checkpoint)
torch.save(checkpoint,Path) ## save for each 10 iteration