def plot_conv_weights(layer, figsize=(6, 6)):
 W = layer.W.get_value()
 shape = W.shape
 nrows = np.ceil(np.sqrt(shape[0])).astype(int)
 ncols = nrows
 for feature_map in range(shape[1]):
  (figs, axes) = plt.subplots(nrows, ncols, figsize=figsize, squeeze=False)
  for ax in axes.flatten():
   ax.set_xticks([])
   ax.set_yticks([])
   ax.axis('off')
  for (i, (r, c)) in enumerate(product(range(nrows), range(ncols))):
   if (i >= shape[0]):
    break
   axes[(r, c)].imshow(W[(i, feature_map)], cmap='gray', interpolation='none')
 return plt

def plot_conv_weights ( layer , figsize = ( 6 , 6 ) ) : W = layer . W . get_value ( ) shape = W . shape nrows = np . ceil ( np . sqrt ( shape [ 0 ] ) ) . astype ( int ) ncols = nrows for feature_map in range ( shape [ 1 ] ) : ( figs , axes ) = plt . subplots ( nrows , ncols , figsize = figsize , squeeze = False ) for ax in axes . flatten ( ) : ax . set_xticks ( [ ] ) ax . set_yticks ( [ ] ) ax . axis ( 'off' ) for ( i , ( r , c ) ) in enumerate ( product ( range ( nrows ) , range ( ncols ) ) ) : if ( i >= shape [ 0 ] ) : break axes [ ( r , c ) ] . imshow ( W [ ( i , feature_map ) ] , cmap = 'gray' , interpolation = 'none' ) return plt
plot the weights of a specific layer .