

def save_tiled_raster_images(tiled_img, filename):
    '\n    Save a a return value from `tile_raster_images` to `filename`.\n\n    Returns\n    -------\n    img : WRITEME\n        The PIL image that was saved\n    '
    if (tiled_img.ndim == 2):
        ensure_Image()
        img = Image.fromarray(tiled_img, 'L')
    elif (tiled_img.ndim == 3):
        ensure_Image()
        img = Image.fromarray(tiled_img, 'RGBA')
    else:
        raise TypeError('bad ndim', tiled_img)
    img.save(filename)
    return img

dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/packaged_dependencies/theano_linear/imaging.py save_tiled_raster_images/original