Class IterativeProcess

Defined in core/utils/

A process that includes an initialization and iterated computation.

An iterated process will usually be driven by a control loop like:

def initialize():

def next(state):

iterative_process = IterativeProcess(initialize, next)
state = iterative_process.initialize()
for round in range(num_rounds):
  state =

The iteration step can accept arguments in addition to state (which must be the first argument), and return additional arguments:

def next(state, item):

iterative_process = ...
state = iterative_process.initialize()
for round in range(num_rounds):
  state, output =, round)



Creates a tff.IterativeProcess.


  • initialize_fn: a no-arg tff.Computation that creates the initial state of the chained computation.
  • next_fn: a tff.Computation that defines an iterated function. If initialize_fn returns a type T, then next_fn must also return type T or multiple values where the first is of type T, and accept either a single argument of type T or multiple arguments where the first argument must be of type T.


  • TypeError: initialize_fn and next_fn are not compatible function types.



A no-arg tff.Computation that returns the initial state.


A tff.Computation that produces the next state.

The first argument of should always be the current state (originally produced by tff.IterativeProcess.initialize), and the first (or only) returned value is the updated state.


A tff.Computation.