X = x_test[i:i+1]
# Visualize weights
W = model.layers[1].get_weights()[0][:,:,0,:]
w1=W.reshape(16,3,3)
W = np.squeeze(w1)
print("W shape : ", W.shape)
for i in range(0,16):
plt.subplot(4,4,i+1)
plt.imshow(w1[i,:,:], interpolation='nearest',cmap='gray')
plt.show()
W = model.layers[2].get_weights()[0][:,:,0,:]
w2=W.reshape(8,3,3)
W = np.squeeze(w2)
print("W shape : ", W.shape)
for i in range(0,8):
plt.subplot(4,4,i+1)
plt.imshow(w2[i,:,:], interpolation='nearest',cmap='gray')
plt.show()