Allows the fizzbuzz example to work when called as fizzbuzz(tf.constant(10)).

Fixes #18960

PiperOrigin-RevId: 197008373
This commit is contained in:
Alexandre Passos 2018-05-17 10:02:06 -07:00 committed by TensorFlower Gardener
parent 09a5f58fdc
commit f4162b7eaf

View 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')