Allows the fizzbuzz example to work when called as fizzbuzz(tf.constant(10)).
Fixes #18960 PiperOrigin-RevId: 197008373
This commit is contained in:
parent
09a5f58fdc
commit
f4162b7eaf
@ -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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user