In [4]:
# As usual, a bit of setup

import numpy as np
import matplotlib.pyplot as plt
import cPickle

import sys
sys.path.append('../../deuNet/')
from deuNet.utils.vis_utils import visualize_grid

%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'

# for auto-reloading external modules
# see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython
%load_ext autoreload
%autoreload 2

def rel_error(x, y):
  """ returns relative error """
  return np.max(np.abs(x - y) / (np.maximum(1e-8, np.abs(x) + np.abs(y))))


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

In [5]:
weights = cPickle.load(open('tmpweights.plk'))

In [7]:
print weights.shape
grid = visualize_grid(weights.transpose(0, 2, 3, 1))
plt.imshow(grid.astype('uint8'))


Out[7]:
(32, 1, 3, 3)

In [ ]: