Skip to content

Instantly share code, notes, and snippets.

@alexbw
Created July 17, 2018 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexbw/db6da31d34542cf6810ad52d901f3469 to your computer and use it in GitHub Desktop.
Save alexbw/db6da31d34542cf6810ad52d901f3469 to your computer and use it in GitHub Desktop.
Lists with AutoGraph
def f(n):
z = []
# We ask you to tell us the element dtype of the list
autograph.set_element_type(z, tf.int32)
for i in range(n):
z.append(i)
# when you're done with the list, stack it
# (this is just like np.stack)
return autograph.stack(z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment