Skip to content

Instantly share code, notes, and snippets.

@Blaizzy
Last active March 27, 2019 18:59
Show Gist options
  • Select an option

  • Save Blaizzy/a878d12f5bd6039aef0177d9e551b30c to your computer and use it in GitHub Desktop.

Select an option

Save Blaizzy/a878d12f5bd6039aef0177d9e551b30c to your computer and use it in GitHub Desktop.
@tf.function
def f(x):
for i in range(10): # Static python loop, we'll not convert it
do_stuff()
for i in tf.range(10): # depends on a tensor, we'll convert it
# function call
f(10)
# If you're curious you can inspect the code autograph generates.
# PS: Read the code at your own risk !!!
print(tf.autograph.to_code(f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment