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 [9]:
weights = cPickle.load(open('tmpweights.plk'))

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


(32, 1, 3, 3)
Out[8]:
<matplotlib.image.AxesImage at 0x35d9490>

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


(32, 1, 3, 3)
Out[12]:
<matplotlib.image.AxesImage at 0x3636d10>

In [ ]: