class_docstr: Tests function periodically.
class_docstr_tok: ["Tests","function","periodically","."]
docstr: Tests that a function is called exactly every `period` steps.
docstr_tok: ["Tests","that","a","function","is","called","exactly","every","`","period","`","steps","."]
code: def testPeriodically(self):
      """Tests that a function is called exactly every `period` steps."""
      target = tf.Variable(0)
      period = 3
  
      periodic_update = periodic_ops.periodically(
          body=lambda: target.assign_add(1).op, period=period
      )
  
      with self.test_session() as sess:
          sess.run(tf.global_variables_initializer())
          desired_values = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4]
          for desired_value in desired_values:
              sess.run(periodic_update)
              result = sess.run(target)
              self.assertEqual(desired_value, result)
  
file_path: trfl/trfl/periodic_ops_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow.compat.v1
  from trfl import periodic_ops
label_desc: Use image node_id 1 for calling the PeriodicallyTest obj's underlying member method code with example usage: obj.testPeriodically() without return types