code: def kl_with_logits(
      p_logits,
      q_logits,
      scope=None,
      loss_collection=tf.GraphKeys.REGULARIZATION_LOSSES,
  ):
      """Helper function to compute kl-divergence KL(p || q)"""
      with tf.name_scope(scope, "kl_divergence") as name:
          p = tf.nn.softmax(p_logits)
          p_log = tf.nn.log_softmax(p_logits)
          q_log = tf.nn.log_softmax(q_logits)
          loss = reduce_mean(
              reduce_sum(p * (p_log - q_log), axis=1), name=name
          )
          tf.losses.add_loss(loss, loss_collection)
          return loss
  
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 9 for calling a global function with example usage: kl_with_logits(p_logits, q_logits, scope, loss_collection) and returns: loss