Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings


View source on GitHub

Periodically performs the tensorflow op in body.

    body, period, name='periodically'

The body tensorflow op will be executed every period times the periodically op is executed. More specifically, with n the number of times the op has been executed, the body will be executed when n is a non zero positive multiple of period (i.e. there exist an integer k > 0 such that k * period == n).

If period is None, it will not perform any op and will return a tf.no_op().

If period is 1, it will just execute the body, and not create any counters or conditionals.


  • body: callable that returns the tensorflow op to be performed every time an internal counter is divisible by the period. The op must have no output (for example, a tf.group()).
  • period: inverse frequency with which to perform the op.
  • name: name of the variable_scope.


  • TypeError: if body is not a callable.


An op that periodically performs the specified op.