A stateful process that produces metrics.

Inherits From: IterativeProcess

This class inherits the constraints documented by tff.templates.IterativeProcess.

A tff.templates.MeasuredProcess is a tff.templates.IterativeProcess whose next computation returns a tff.templates.MeasuredProcessOutput.

Unlike tff.templates.IterativeProcess, the more generic but less-defined template, arbitrary tff.templates.MeasuredProcesses can be composed together. See tff.templates.chain_measured_processes docstring for the guidance of composition.

initialize_fn A no-arg tff.Computation that returns the initial state of the measured process. Let the type of this state be called S.
next_fn A tff.Computation that represents the iterated function. The first or only argument must be assignable from ( tff.types.Type.is_assignable_from must return True) the state type S. The return value must be a MeasuredProcessOutput whose state member is assignable to the first argument (same requirement as the S type).
next_is_multi_arg An optional boolean indicating that next_fn will receive more than just the state argument (if True) or only the state argument (if False). This parameter is primarily used to provide better error messages.

TypeError If initialize_fn and next_fn are not instances of tff.Computation.
TemplateInitFnParamNotEmptyError If initialize_fn has any input arguments.
TemplateStateNotAssignableError If the state returned by either initialize_fn or next_fn is not assignable to the first input argument of next_fn.
TemplateNotMeasuredProcessOutputError If next_fn does not return a MeasuredProcessOutput.

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

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

state_type The tff.Type of the state of the process.