def loadModel(self, filepath):
     '''
     加载权重参数
     :param filepath:
     :return:
     '''
     model = Net()
     model.cuda()
     model.load_state_dict(torch.load(filepath))
     return model
 def main(self):
     # torch.cuda.manual_seed(self.config.SEED)
     model = Net()
     # 利用GPU训练
     model.cuda()
     # 训练三世代
     for e in range(self.config.EPOCHS):
         self.train(model)
         self.test(model)
     self.saveModel(model, 'lianzheng_mnist.pth')
     self.saveONNX(model, 'lianzheng_mnist.onnx')
     return model