code: def initialize_uninitialized_global_variables(sess):
      """
      Only initializes the variables of a TensorFlow session that were not
      already initialized.
      :param sess: the TensorFlow session
      :return:
      """
      # List all global variables
      global_vars = tf.global_variables()
  
      # Find initialized status for all variables
      is_var_init = [
          tf.is_variable_initialized(var) for var in global_vars
      ]
      is_initialized = sess.run(is_var_init)
  
      # List all variables that were not initialized previously
      not_initialized_vars = [
          var
          for (var, init) in zip(global_vars, is_initialized)
          if not init
      ]
  
      # Initialize all uninitialized variables found, if any
      if len(not_initialized_vars):
          sess.run(tf.variables_initializer(not_initialized_vars))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import logging
  import math
  import os
  import time
  import warnings
  import numpy
  import six
  from six.moves import xrange
  import tensorflow
  from cleverhans.compat import device_lib
  from cleverhans.compat import reduce_sum, reduce_mean
  from cleverhans.compat import reduce_max
  from cleverhans.compat import softmax_cross_entropy_with_logits
  from cleverhans.utils import batch_indices, _ArgsWrapper, create_logger
label_desc: Use image node_id 2 for calling a global function with example usage: initialize_uninitialized_global_variables(sess) without return types