code: def diagonal_gaussian_kl(mu0, log_std0, mu1, log_std1):
      """
      tf symbol for mean KL divergence between two batches of diagonal gaussian distributions,
      where distributions are specified by means and log stds.
      (https://en.wikipedia.org/wiki/Kullback-Leibler_divergence#Multivariate_normal_distributions)
      """
      var0, var1 = tf.exp(2 * log_std0), tf.exp(2 * log_std1)
      pre_sum = (
          0.5 * (((mu1 - mu0) ** 2 + var0) / (var1 + EPS) - 1)
          + log_std1
          - log_std0
      )
      all_kls = tf.reduce_sum(pre_sum, axis=1)
      return tf.reduce_mean(all_kls)
  
imports: import numpy
  import tensorflow
  import scipy.signal
  from gym.spaces import Box, Discrete
label_desc: Use image node_id 12 for calling a global function with example usage: diagonal_gaussian_kl(mu0, log_std0, mu1, log_std1) and returns: tf