Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env python3
from PIL import Image
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
# smooth values from point a to point b.
STEPS = 100
pt_a = np.random.normal(size=(512))
pt_b = np.random.normal(size=(512))
z = np.empty((STEPS, 512))
for i, alpha in enumerate(np.linspace(start=0.0, stop=1.0, num=STEPS)):
z[i] = alpha * pt_a + (1.0-alpha) * pt_b
# sample all z and write out as separate images.
generator = hub.Module("")
with tf.Session() as sess:
imgs =
imgs = (imgs * 255).astype(np.uint8)
for i, img in enumerate(imgs):
Image.fromarray(img).save("foo_%02d.png" % i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment