The following code will not produce "Fizz" when the value of i
is a multiple of 3:
@tf.function
def fizzbuzz(n):
msg = tf.constant('')
for i in tf.range(n):
if int(i % 3) == 0:
msg += 'Fizz'
elif tf.equal(i % 5, 0):
msg += 'Buzz'
else:
msg += tf.as_string(i)
msg += '\n'
return msg
print(fizzbuzz(tf.constant(15)).numpy().decode())
But if one comments the @tf.function
decorator out, it works normally for multiples of 3. How come?