# -*- coding:utf-8 -*- import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec
print"Show first conv2d result:" print"conv2d shape:", h_conv1_res.shape gs1 = gridspec.GridSpec(4, 8) for x inrange(4): for y inrange(8): plt.subplot(gs1[x, y]) plt.imshow(h_conv1_res[0, :, :, x * 4 + y]) plt.show()
print"Show first max_pool result:" print"max_pool shape:", h_pool1_res.shape gs1 = gridspec.GridSpec(4, 8) for x inrange(4): for y inrange(8): plt.subplot(gs1[x, y]) plt.imshow(h_pool1_res[0, :, :, x * 4 + y]) plt.show()
print"Show second conv2d result:" print"conv2 shape:", h_conv2_res.shape gs1 = gridspec.GridSpec(8, 8) for x inrange(8): for y inrange(8): plt.subplot(gs1[x, y]) plt.imshow(h_conv2_res[0, :, :, x * 8 + y]) plt.show()
print"Show second max_pool result:" print"max_pool shape:", h_pool2_res.shape gs1 = gridspec.GridSpec(8, 8) for x inrange(8): for y inrange(8): plt.subplot(gs1[x, y]) plt.imshow(h_pool2_res[0, :, :, x * 8 + y]) plt.show()
Show input:
input shape: (28, 28)
Show first conv2d result:
conv2d shape: (1, 28, 28, 32)
Show first max_pool result:
max_pool shape: (1, 14, 14, 32)
Show second conv2d result:
conv2 shape: (1, 14, 14, 64)
Show second max_pool result:
max_pool shape: (1, 7, 7, 64)