Skip to content

Instantly share code, notes, and snippets.

@yaroslavvb2
Last active October 31, 2017 22:46
Show Gist options
  • Save yaroslavvb2/53a62551e690b72108495252b9f9177a to your computer and use it in GitHub Desktop.
Save yaroslavvb2/53a62551e690b72108495252b9f9177a to your computer and use it in GitHub Desktop.
# expensive way to compute factorial of n
def factorial(n):
def f(x):
return tf.pow(x, n)
for i in range(n):
f = tfe.gradients_function(f)
return f(1.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment