code: def _get_mdn_loss(
      logmix, mean, logstd, y, batch_mask, dont_reduce_loss
  ):
      """Computes MDN loss term for svg decoder model."""
      logsqrttwopi = np.log(np.sqrt(2.0 * np.pi))
  
      v = logmix + _tf_lognormal(y, mean, logstd, logsqrttwopi)
      v = tf.reduce_logsumexp(v, 1, keepdims=True)
      v = tf.reshape(v, [-1, 51, 1, 6])
  
      # mask out unimportant terms given the ground truth commands
      v = tf.multiply(v, batch_mask)
      if dont_reduce_loss:
          return -tf.reduce_mean(tf.reduce_sum(v, axis=3), [1, 2])
      return -tf.reduce_mean(tf.reduce_sum(v, axis=3))
  
file_path: magenta/magenta/models/svg_vae/svg_decoder_loss.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import modalities
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 2 for calling a global function with example usage: _get_mdn_loss(logmix, mean, logstd, y, batch_mask, dont_reduce_loss) and returns: unknown, unknown