code: def _gen_simple_while_loop(base_dir):
      """Generates a saved model with a while loop."""
  
      class Module(module.Module):
          """A module with a while loop."""
  
          @def_function.function(
              input_signature=[
                  tensor_spec.TensorSpec((), dtypes.float32)
              ]
          )
          def compute(self, value):
              acc, _ = while_loop.while_loop(
                  cond=lambda acc, i: i > 0,
                  body=lambda acc, i: (acc + i, i - 1),
                  loop_vars=(constant_op.constant(0.0), value),
              )
              return acc
  
      to_save = Module()
      saved_model.save(
          to_save, export_dir=os.path.join(base_dir, "SimpleWhileLoop")
      )
  
file_path: tensorflow/tensorflow/c/experimental/saved_model/internal/testdata/gen_saved_models.py
imports: import os
  from absl import app
  from tensorflow.python.compat import v2_compat
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.module import module
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops import while_loop
  from tensorflow.python.saved_model import saved_model
label_desc: Use image node_id 2 for calling a global function with example usage: _gen_simple_while_loop(base_dir) and returns: acc