def interp(net, layers):
 for l in layers:
  (m, k, h, w) = net.params[l][0].data.shape
  if ((m != k) and (k != 1)):
   print 'input + output channels need to be the same or |output| == 1'
   raise
  if (h != w):
   print 'filters need to be square'
   raise
  filt = upsample_filt(h)
  net.params[l][0].data[range(m), range(k), :, :] = filt

def interp ( net , layers ) : for l in layers : ( m , k , h , w ) = net . params [ l ] [ 0 ] . data . shape if ( ( m != k ) and ( k != 1 ) ) : print 'input + output channels need to be the same or |output| == 1' raise if ( h != w ) : print 'filters need to be square' raise filt = upsample_filt ( h ) net . params [ l ] [ 0 ] . data [ range ( m ) , range ( k ) , : , : ] = filt
set weights of each layer in layers to bilinear kernels for interpolation .