zeroinput = Variable(torch.zeros([batch_size, hidden_d,1,1])).cuda() g_zero_output = gnet(torch.cat([g_f3, zeroinput], 1)) g_sampler2 = Variable((torch.randn([batch_size, hidden_d,1,1])-1)*2.5).cuda() g_f3_output1 = gnet(torch.cat([g_f3, g_sampler2], 1)) g_sampler3 = Variable(torch.randn([batch_size,hidden_d,1,1])).cuda() # zeroinput2 = Variable(torch.zeros([batch_size, 10, hidden_d, hidden_d])).cuda() # g_f3_output2 = gnet(torch.cat([zeroinput2, g_sampler3], 1)) owntool.save_picture(data, out_dir + "recon_epoch{}_data.png".format(epoch ),column=column) owntool.save_picture(data_old, out_dir + "recon_epoch{}_data_old.png".format(epoch ),column=column) owntool.save_picture(g_zero_output, out_dir + "recon_epoch{}_zero.png".format(epoch),column=column) owntool.save_picture(g_f3_output1, out_dir + "recon_epoch{}_real.png".format(epoch),column=column) # owntool.save_picture(g_f3_output2, out_dir + "recon_f3_epoch{}_noise.png".format(epoch)) # owntool.save_picture(data,out_dir + "/recon_o_epoch{}_{}.png".format(epoch,batch_index)) # owntool.save_picture(g_f3_output,out_dir + "/recon_g_f3_epoch{}_{}.png".format(epoch,batch_index)) print("%s: D: %s/%s G: %s (Real: %s, Fake: %s)"% (epoch, owntool.extract(d_real_error)[0], owntool.extract(d_false_error)[0], owntool.extract(dg_error)[0], owntool.stats(owntool.extract(d_real_decision)), owntool.stats(owntool.extract(d_false_decision)) ) ) if(epoch%(check_points*10)==0): torch.save(gnet.state_dict(), '{}/G_{}.model'.format(out_dir, str(epoch))) torch.save(dnet.state_dict(), '{}/D_{}.model'.format(out_dir, str(epoch)))
1]))).cuda() g_f3_output1 = G(torch.cat([g_f3, g_sampler2], 1)) # owntool.save_picture(data, out_dir + "recon_epoch{}_data.png".format(epoch ),column=column) owntool.save_picture(data_g, out_dir + "recon_epoch{}_data_old.png".format(epoch), column=column) owntool.save_picture(g_zero_output, out_dir + "recon_epoch{}_zero.png".format(epoch), column=column) owntool.save_picture(g_f3_output1, out_dir + "recon_epoch{}_real.png".format(epoch), column=column) print("%s: D: %s/%s G: %s (Real: %s, Fake: %s) E: %s" % (epoch, owntool.extract(d_real_error)[0], owntool.extract(d_false_error)[0], owntool.extract(dg_error)[0], owntool.stats(owntool.extract(d_real_decision)), owntool.stats(owntool.extract(d_false_decision)), owntool.stats(owntool.extract(E_loss)[0]))) if (epoch % (check_points * 10) == 0): np.set_printoptions(precision=2, suppress=True) print("real") print(np.array(E_real.data.tolist())) print("anch") print(np.array(E_anch.data.tolist())) print("fake") print(np.array(E_fake.data.tolist())) torch.save(G.state_dict(), '{}/G_{}.model'.format(out_dir, str(epoch))) torch.save(D.state_dict(), '{}/D_{}.model'.format(out_dir, str(epoch)))