def get_weights_as_images(weights_npy, width, height, outdir='img/',
                          n_images=10, img_type='grey'):
    """Create and save the weights of the hidden units as images.
    :param weights_npy: path to the weights .npy file
    :param width: width of the images
    :param height: height of the images
    :param outdir: output directory
    :param n_images: number of images to generate
    :param img_type: 'grey' or 'color' (RGB)
    """
    weights = np.load(weights_npy)
    perm = np.random.permutation(weights.shape[1])[:n_images]

    for p in perm:
        w = np.array([i[p] for i in weights])
        image_path = outdir + 'w_{}.png'.format(p)
        gen_image(w, width, height, image_path, img_type)
Create and save the weights of the hidden units as images.
    :param weights_npy: path to the weights .npy file
    :param width: width of the images
    :param height: height of the images
    :param outdir: output directory
    :param n_images: number of images to generate
    :param img_type: 'grey' or 'color' (RGB)
    
yadlt/utils/utilities.py