def load_model(self, epoch):
weights_toload = np.load(self.args.out_dir + '/Dweights_params_epoch{}.npz'.format(epoch))
weights_list_toload = [weights_toload['arr_{}'.format(k)] for k in range(len(weights_toload.files))]
LL.set_all_param_values(self.D_weights_layer, weights_list_toload)
weights_toload = np.load(self.args.out_dir + '/Gweights_params_epoch{}.npz'.format(epoch))
weights_list_toload = [weights_toload['arr_{}'.format(k)] for k in range(len(weights_toload.files))]
LL.set_all_param_values(self.G_weights_layer, weights_list_toload)
for i in range(self.args.ng):
weights_toload = np.load(self.args.out_dir + '/disc%d_params_epoch%d.npz' % (i,epoch))
weights_list_toload = [weights_toload['arr_{}'.format(k)] for k in range(len(weights_toload.files))]
LL.set_all_param_values(self.D_layers[i], weights_list_toload)
weights_toload = np.load(self.args.out_dir + '/gen%d_params_epoch%d.npz' % (i,epoch))
weights_list_toload = [weights_toload['arr_{}'.format(k)] for k in range(len(weights_toload.files))]
LL.set_all_param_values(self.G_layers[i], weights_list_toload)
评论列表
文章目录