

def mat_to_img(w, dim_input, scale=False, colorImg=False, tile_spacing=(1, 1), tile_shape=0):
    if (tile_shape == 0):
        rowscols = int((w.shape[1] ** 0.5))
        tile_shape = (rowscols, rowscols)
    imgs = tile_raster_images(X=w.T, img_shape=dim_input, tile_shape=tile_shape, tile_spacing=tile_spacing, scale=scale, colorImg=colorImg)
    return PIL.Image.fromarray(imgs)

dataset/ETHPy150Open dpkingma/nips14-ssl/anglepy/paramgraphics.py mat_to_img/original