1.当我运行代码时,我得到 else: print("no checkpoint found") 2.IndentationError: unindent does not match any external indentation level 3.我试图修复它,但我不能
def Score(self):
return sum(self.reward_window)/(len(self.reward_window)+1.)
def Save(self):
torch.save({'state_dict' : self.model.state_dict(),
'optimizer' : self.optimizer.state_dict,
},'last_brain.pth')
def Load(self) :
if os.path.isfile('last_brain.pth') : # this is where i get the syntax error
print("=> Loading last brain...")
lastbrain = torch.load('last_brain.pth')
self.model.load_state_dict(checkpoint['state_dict'])
self.optimizer.load_state_dict(checkpoint['optimizer'])
print ("done")
else: print("no checkpoint found")
守着一只汪
慕婉清6462132
相关分类