def plot_real( args, x_sample, dir, size_x=3, size_y=3):
x_sample = x_sample.data.cpu().numpy()[:size_x*size_y]
fig = plt.figure(figsize=(size_x, size_y))
gs = gridspec.GridSpec(size_x, size_y)
gs.update(wspace=0.05, hspace=0.05)
for i, sample in enumerate(x_sample):
ax = plt.subplot(gs[i])
plt.axis('off')
ax.set_xticklabels([])
ax.set_yticklabels([])
ax.set_aspect('equal')
plt.imshow(sample.reshape(args.input_size[1], args.input_size[2]), cmap='Greys_r')
plt.savefig(dir + 'real.png', bbox_inches='tight')
plt.close(fig)
#=======================================================================================================================
评论列表
文章目录