code: def normalized_mean_square_error(
      output, target, axis=-1, name="normalized_mean_squared_error_loss"
  ):
      """Return the TensorFlow expression of normalized mean-square-error of two distributions.
  
      Parameters
      ----------
      output : Tensor
          2D, 3D or 4D tensor i.e. [batch_size, n_feature], [batch_size, height, width] or [batch_size, height, width, channel].
      target : Tensor
          The target distribution, format the same with `output`.
      axis : int or list of int
          The dimensions to reduce.
      name : str
          An optional name to attach to this function.
  
      """
      with tf.name_scope("normalized_mean_squared_error_loss"):
          # if len(output.shape) == 2:  # [batch_size, n_feature]
          #     axis = 1
          # elif len(output.shape) == 3:  # [batch_size, w, h]
          #     axis = [1, 2]
          # elif len(output.shape) == 4:  # [batch_size, w, h, c]
          #     axis = [1, 2, 3]
          nmse_a = tf.sqrt(
              tf.reduce_sum(
                  tf.math.squared_difference(output, target), axis=axis
              )
          )
          nmse_b = tf.sqrt(tf.reduce_sum(tf.square(target), axis=axis))
          nmse = tf.reduce_mean(nmse_a / nmse_b, name=name)
      return nmse
  
imports: import numbers
  import tensorflow
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops, math_ops, nn_ops, standard_ops
  from tensorlayer import logging
label_desc: Use image node_id 5 for calling a global function with example usage: normalized_mean_square_error(output, target, axis, name) and returns: nmse