code: def softmax_preds(images, ckpt_path, return_logits=False):
      """
      Compute softmax activations (probabilities) with the model saved in the path
      specified as an argument
      :param images: a np array of images
      :param ckpt_path: a TF model checkpoint
      :param logits: if set to True, return logits instead of probabilities
      :return: probabilities (or logits if logits is set to True)
      """
      # Compute nb samples and deduce nb of batches
      data_length = len(images)
      nb_batches = math.ceil(len(images) / FLAGS.batch_size)
  
      # Declare data placeholder
      train_data_node = _input_placeholder()
  
      # Build a Graph that computes the logits predictions from the placeholder
      if FLAGS.deeper:
          logits = inference_deeper(train_data_node)
      else:
          logits = inference(train_data_node)
  
      if return_logits:
          # We are returning the logits directly (no need to apply softmax)
          output = logits
      else:
          # Add softmax predictions to graph: will return probabilities
          output = tf.nn.softmax(logits)
  
      # Restore the moving average version of the learned variables for eval.
      variable_averages = tf.train.ExponentialMovingAverage(
          MOVING_AVERAGE_DECAY
      )
      variables_to_restore = variable_averages.variables_to_restore()
      saver = tf.train.Saver(variables_to_restore)
  
      # Will hold the result
      preds = np.zeros((data_length, FLAGS.nb_labels), dtype=np.float32)
  
      # Create TF session
      with tf.Session() as sess:
          # Restore TF session from checkpoint file
          saver.restore(sess, ckpt_path)
  
          # Parse data by batch
          for batch_nb in xrange(0, int(nb_batches + 1)):
              # Compute batch start and end indices
              start, end = utils.batch_indices(
                  batch_nb, data_length, FLAGS.batch_size
              )
  
              # Prepare feed dictionary
              feed_dict = {train_data_node: images[start:end]}
  
              # Run session ([0] because run returns a batch with len 1st dim == 1)
              preds[start:end, :] = sess.run(
                  [output], feed_dict=feed_dict
              )[0]
  
      # Reset graph to allow multiple calls
      tf.reset_default_graph()
  
      return preds
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from datetime import datetime
  import math
  import numpy
  from six.moves import xrange
  import tensorflow.compat.v1
  import time
  import utils
label_desc: Use image node_id 10 for calling a global function with example usage: softmax_preds(images, ckpt_path, return_logits) and returns: preds