tf.autograph.experimental.set_loop_options
Specifies additional arguments to be passed to the enclosing while_loop.
Aliases:
tf.compat.v1.autograph.experimental.set_loop_options
tf.compat.v2.autograph.experimental.set_loop_options
tf.autograph.experimental.set_loop_options(
parallel_iterations=UNSPECIFIED,
back_prop=UNSPECIFIED,
swap_memory=UNSPECIFIED,
maximum_iterations=UNSPECIFIED
)
The parameters apply to and only to the immediately enclosing loop. It only has effect if the loop is staged as a TF while_loop; otherwise the parameters have no effect.
Usage example:
@tf.function(autograph=True) def dynamic_rnn(..., parallel_iterations=32): num_steps = ... for t in tf.range(num_steps): tf.autograph.experimental.set_loop_options( parallel_iterations=parallel_iterations) ...
Args:
parallel_iterations
: See tf.while_loop.back_prop
: See tf.while_loop.swap_memory
: See tf.while_loop.maximum_iterations
: See tf.while_loop.