def _get_conv_weights_bc01(layer):
 assert isinstance(layer, (MaxoutConvC01B, ConvElemwise))
 weights = layer.get_params()[0].get_value()
 if isinstance(layer, MaxoutConvC01B):
  c01b = Conv2DSpace(shape=weights.shape[1:3], num_channels=weights.shape[0], axes=('c', 0, 1, 'b'))
  bc01 = Conv2DSpace(shape=c01b.shape, num_channels=c01b.num_channels, axes=('b', 'c', 0, 1))
  weights = c01b.np_format_as(weights, bc01)
 elif isinstance(layer, ConvElemwise):
  weights = weights[:, :, ::(-1), ::(-1)]
 return weights

def _get_conv_weights_bc01 ( layer ) : assert isinstance ( layer , ( MaxoutConvC01B , ConvElemwise ) ) weights = layer . get_params ( ) [ 0 ] . get_value ( ) if isinstance ( layer , MaxoutConvC01B ) : c01b = Conv2DSpace ( shape = weights . shape [ 1 : 3 ] , num_channels = weights . shape [ 0 ] , axes = ( 'c' , 0 , 1 , 'b' ) ) bc01 = Conv2DSpace ( shape = c01b . shape , num_channels = c01b . num_channels , axes = ( 'b' , 'c' , 0 , 1 ) ) weights = c01b . np_format_as ( weights , bc01 ) elif isinstance ( layer , ConvElemwise ) : weights = weights [ : , : , : : ( - 1 ) , : : ( - 1 ) ] return weights
returns a conv .