Avoiding Pitfalls: Loop Rewriting Best Practices

For efficient AutoGraph transformation, loops must iterate over `tf.Tensor` values or `tf.data.Dataset` objects; looping over Python/NumPy iterables within `@tf.function` can lead to inefficient graph unrolling or eager execution during tracing.

Sources

Open the full topic