code: def log_weight(probs, weights, name="log_weight"):
      """Log weight.
  
      Parameters
      -----------
      probs : tensor
          If it is a network output, usually we should scale it to [0, 1] via softmax.
      weights : tensor
          The weights.
  
      Returns
      --------
      Tensor
          The Tensor after appling the log weighted expression.
  
      """
      with tf.variable_scope(name):
          exp_v = tf.reduce_mean(tf.log(probs) * weights)
          return exp_v
  
imports: import numpy
  import tensorflow
  from six.moves import xrange
label_desc: Use image node_id 3 for calling a global function with example usage: log_weight(probs, weights, name) and returns: exp_v