code: def test_static_num_iters(self, iters):
      counter = None
      # following loop variables not @parameterized because the tf.constants
      # would be executed outside the Eager mode that
      # @test_util.test_all_tf_execution_regimes creates
      for n in [
          iters,
          tf.constant(iters, dtype=tf.int64),
          tf.constant(iters, dtype=tf.int32),
      ]:
          counter = collections.Counter()
  
          def body(x):
              counter["body_calls"] += 1
              return [x + 1]
  
          result = loop_util.smart_for_loop(
              loop_num_iter=n,
              body_fn=body,
              initial_loop_vars=[tf.constant(1)],
          )
          if JAX_MODE:  # JAX always traces loop bodies exactly once
              self.assertEqual(1, counter["body_calls"])
          elif tf.executing_eagerly():
              self.assertEqual(iters, counter["body_calls"])
          else:
              expected_num_calls = 1 if iters > 0 else 0
              self.assertEqual(
                  expected_num_calls, counter["body_calls"]
              )
          self.assertAllClose([iters + 1], self.evaluate(result))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import loop_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 1 for calling the SmartForLoopTest obj's underlying member method code with example usage: obj.test_static_num_iters(iters) and returns: list