def sliceable(dim, pad=0):
 dim0 = (np.prod(dim[:(-1)]) + pad)
 return (dim0, dim[(-1)])

def sliceable ( dim , pad = 0 ) : dim0 = ( np . prod ( dim [ : ( - 1 ) ] ) + pad ) return ( dim0 , dim [ ( - 1 ) ] )
collapse outer dimensions into one and preserve inner dimension this allows for easy cpu operations in numpy .