def applySparseFilter(kerns, kshp, nkern, images, imgshp, step=(1, 1), bias=None, mode='valid'):
 if (numpy.size(imgshp) == 2):
  imgshp = ((1,) + imgshp)
 (indices, indptr, spmat_shape, sptype, outshp, kmap) = convolution_indices.sparse_eval(imgshp, kshp, nkern, step, mode)
 sparsew = theano.sparse.CSM(sptype, kmap)(kerns, indices, indptr, spmat_shape)
 output = sparse.structured_dot(sparsew, images.T).T
 if (bias is not None):
  output += bias
 return (output, numpy.hstack((nkern, outshp)))

def applySparseFilter ( kerns , kshp , nkern , images , imgshp , step = ( 1 , 1 ) , bias = None , mode = 'valid' ) : if ( numpy . size ( imgshp ) == 2 ) : imgshp = ( ( 1 , ) + imgshp ) ( indices , indptr , spmat_shape , sptype , outshp , kmap ) = convolution_indices . sparse_eval ( imgshp , kshp , nkern , step , mode ) sparsew = theano . sparse . CSM ( sptype , kmap ) ( kerns , indices , indptr , spmat_shape ) output = sparse . structured_dot ( sparsew , images . T ) . T if ( bias is not None ) : output += bias return ( output , numpy . hstack ( ( nkern , outshp ) ) )
writeme output feature map will have shape batch_size x number of kernels * output_size .