Allows the fizzbuzz example to work when called as fizzbuzz(tf.constant(10)).
authorAlexandre Passos <apassos@google.com>
Thu, 17 May 2018 17:02:06 +0000 (10:02 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Thu, 17 May 2018 17:05:07 +0000 (10:05 -0700)
Fixes #18960

PiperOrigin-RevId: 197008373

tensorflow/docs_src/programmers_guide/eager.md

index 9719858..970ec71 100644 (file)
@@ -118,7 +118,7 @@ it is easy to write [fizzbuzz](https://en.wikipedia.org/wiki/Fizz_buzz):
 ```py
 def fizzbuzz(max_num):
   counter = tf.constant(0)
-  for num in range(max_num):
+  for num in range(max_num.numpy()):
     num = tf.constant(num)
     if int(num % 3) == 0 and int(num % 5) == 0:
       print('FizzBuzz')