code: def huber_loss(
      output,
      target,
      is_mean=True,
      delta=1.0,
      dynamichuber=False,
      reverse=False,
      axis=-1,
      epsilon=0.00001,
      name=None,
  ):
      """Huber Loss operation, see ``https://en.wikipedia.org/wiki/Huber_loss`` .
      Reverse Huber Loss operation, see  ''https://statweb.stanford.edu/~owen/reports/hhu.pdf''.
      Dynamic Reverse Huber Loss operation, see  ''https://arxiv.org/pdf/1606.00373.pdf''.
  
      Parameters
      ----------
      output : Tensor
          A distribution with shape: [batch_size, ....], (any dimensions).
      target : Tensor
          The target distribution, format the same with `output`.
      is_mean : boolean
          Whether compute the mean or sum for each example.
          - If True, use ``tf.reduce_mean`` to compute the loss between one target and predict data (default).
          - If False, use ``tf.reduce_sum``.
      delta: float
          The point where the huber loss function changes from a quadratic to linear.
      dynamichuber: boolean
          Whether compute the coefficient c for each batch.
          - If True, c is 20% of the maximal per-batch error.
          - If False, c is delta.
      reverse: boolean
          Whether compute the reverse huber loss.
      axis : int or list of int
          The dimensions to reduce.
      epsilon:
          Eplison.
      name : string
          Name of this loss.
  
      """
      if reverse:
          if dynamichuber:
              huber_c = 0.2 * tf.reduce_max(tf.abs(output - target))
          else:
              huber_c = delta
          if is_mean:
              loss = tf.reduce_mean(
                  tf.where(
                      tf.less_equal(tf.abs(output - target), huber_c),
                      tf.abs(output - target),
                      tf.multiply(
                          tf.pow(output - target, 2.0)
                          + tf.pow(huber_c, 2.0),
                          tf.math.divide_no_nan(0.5, huber_c + epsilon),
                      ),
                  ),
                  name=name,
              )
          else:
              loss = tf.reduce_mean(
                  tf.reduce_sum(
                      tf.where(
                          tf.less_equal(
                              tf.abs(output - target), huber_c
                          ),
                          tf.abs(output - target),
                          tf.multiply(
                              tf.pow(output - target, 2.0)
                              + tf.pow(huber_c, 2.0),
                              tf.math.divide_no_nan(
                                  0.5, huber_c + epsilon
                              ),
                          ),
                      ),
                      axis,
                  ),
                  name=name,
              )
      elif is_mean:
          loss = tf.reduce_mean(
              tf.where(
                  tf.less_equal(tf.abs(output - target), delta),
                  0.5 * tf.pow(output - target, 2),
                  delta * (tf.abs(output - target) - 0.5 * delta),
              ),
              name=name,
          )
      else:
          loss = tf.reduce_mean(
              tf.reduce_sum(
                  tf.where(
                      tf.less_equal(tf.abs(output - target), delta),
                      0.5 * tf.pow(output - target, 2),
                      delta * (tf.abs(output - target) - 0.5 * delta),
                  ),
                  axis,
              ),
              name=name,
          )
      return loss
  
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 19 for calling a global function with example usage: huber_loss(output, target, is_mean, delta, dynamichuber, reverse, axis, epsilon, name) and returns: loss