code: def _truncate_at_has_converged(augmented_traced_values):
      """Truncates trace from `trace_fn` wrapped by `_also_trace_has_converged`."""
      traced_values, global_has_converged = augmented_traced_values
      num_steps = ps.argmax(
          ps.concat([global_has_converged, [True]], axis=0)
      )
      return tf.nest.map_structure(
          lambda x: x[: num_steps + 1], traced_values
      )
  
file_path: probability/tensorflow_probability/python/math/minimize.py
imports: import collections
  import functools
  import tensorflow.compat.v2
  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.math.gradient import value_and_gradient
label_desc: Use image node_id 2 for calling a global function with example usage: _truncate_at_has_converged(augmented_traced_values) and returns: tf