def _save(self, phase, epoch): """Save model state dict and generator's samples""" if phase != 'ADV': torch.save(self.gen.state_dict(), cfg.save_model_root + 'gen_{}_{:05d}.pt'.format(phase, epoch)) save_sample_path = cfg.save_samples_root + 'samples_{}_{:05d}.txt'.format(phase, epoch) samples = self.gen.sample(cfg.batch_size, cfg.batch_size) write_tensor(save_sample_path, samples)
def _save(self, phase, epoch): torch.save( self.gen.state_dict(), cfg.save_model_root + 'gen_{}_{:05d}.pt'.format(phase, epoch)) save_sample_path = cfg.save_samples_root + 'samples_{}_{:05d}.txt'.format( phase, epoch) samples = self.gen.sample(cfg.batch_size, cfg.batch_size, self.dis) write_tensor(save_sample_path, samples)
def _save(self, phase, epoch): """Save model state dict and generator's samples""" for i in range(cfg.k_label): torch.save( self.gen_list[i].state_dict(), cfg.save_model_root + 'gen{}_{}_{:05d}.pt'.format(i, phase, epoch)) save_sample_path = cfg.save_samples_root + 'samples_d{}_{}_{:05d}.txt'.format( i, phase, epoch) samples = self.gen_list[i].sample(cfg.batch_size, cfg.batch_size) write_tensor(save_sample_path, samples)
def _save(self, phase, epoch, label_i=None): assert type(label_i) == int torch.save( self.gen.state_dict(), cfg.save_model_root + 'gen_{}_{:05d}.pt'.format(phase, epoch)) save_sample_path = cfg.save_samples_root + 'samples_c{}_{}_{:05d}.txt'.format( label_i, phase, epoch) samples = self.gen.sample(cfg.batch_size, cfg.batch_size, label_i=label_i) write_tensor(save_sample_path, samples)