def _np_conv_ok(volume, kernel, mode):
 np_conv_ok = (volume.ndim == kernel.ndim == 1)
 return (np_conv_ok and ((volume.size >= kernel.size) or (mode != 'same')))

def _np_conv_ok ( volume , kernel , mode ) : np_conv_ok = ( volume . ndim == kernel . ndim == 1 ) return ( np_conv_ok and ( ( volume . size >= kernel . size ) or ( mode != 'same' ) ) )
see if numpy supports convolution of volume and kernel .