          y_bot = img[:, -1:, :, :] - img[:, -2:-1, :, :]
          y_out = K.concatenate([y_top, y_inner, y_bot], axis=1)
          return y_out * 0.5
  
      def diff_xx(img):
          x_left = img[:, :, 1:2, :] + img[:, :, 0:1, :]
          x_inner = img[:, :, 2:, :] + img[:, :, :-2, :]
          x_right = img[:, :, -1:, :] + img[:, :, -2:-1, :]
          x_out = K.concatenate([x_left, x_inner, x_right], axis=2)
          return x_out - 2.0 * img
 
</s> remove     def diff_yy(img):
 </s> add     def _diff_yy(img):
        """ Y-Y Difference """ </s> remove     def diff_y(img):
 </s> add     def _diff_y(img):
        """ Y Difference """ </s> remove     def diff_x(img):
 </s> add     def _diff_x(img):
        """ X Difference """ </s> remove     def diff_xy(img):
 </s> add     def _diff_xy(img):
        """ X-Y Difference """ </s> remove     """
    Calculates the first and second order gradient difference between pixels of
    an image in the x and y dimensions. These gradients are then compared between
    the ground truth and the predicted image and the difference is taken. When
    used as a loss, its minimization will result in predicted images approaching
    the same level of sharpness / blurriness as the ground truth.

    TV+TV2 Regularization with Nonconvex Sparseness-Inducing Penalty
    for Image Restoration, Chengwu Lu & Hua Huang, 2014
    (http://downloads.hindawi.com/journals/mpe/2014/790547.pdf)

    Parameters:
        y_true: The predicted frames at each scale
        y_true: The ground truth frames at each scale
    Return:
        The GD loss
 </s> add     """ Gradient Loss Function.

    Calculates the first and second order gradient difference between pixels of an image in the x
    and y dimensions. These gradients are then compared between the ground truth and the predicted
    image and the difference is taken. When used as a loss, its minimization will result in
    predicted images approaching the same level of sharpness / blurriness as the ground truth.

    Parameters
    ----------
    y_true: tensor or variable
        The ground truth value
    y_pred: tensor or variable
        The predicted value

    Returns
    -------
    tensor
        The loss value

    References
    ----------
    TV+TV2 Regularization with Non-Convex Sparseness-Inducing Penalty for Image Restoration,
    Chengwu Lu & Hua Huang, 2014 - http://downloads.hindawi.com/journals/mpe/2014/790547.pdf
    def _diff_xx(img):
        """ X-X Difference """
          y_bot = img[:, -1:, :, :] - img[:, -2:-1, :, :]
          y_out = K.concatenate([y_top, y_inner, y_bot], axis=1)
          return y_out * 0.5
  
    def _diff_xx(img):
        """ X-X Difference """
          x_left = img[:, :, 1:2, :] + img[:, :, 0:1, :]
          x_inner = img[:, :, 2:, :] + img[:, :, :-2, :]
          x_right = img[:, :, -1:, :] + img[:, :, -2:-1, :]
          x_out = K.concatenate([x_left, x_inner, x_right], axis=2)
          return x_out - 2.0 * img
keep keep keep keep replace keep keep keep keep keep
 Simple backend unit tests (#1020)

* Add simple backend tests for lib.model
* Document lib.model
* Fix GMSD Loss for AMD
* Remove obsolete code from lib.model 
lib/model/losses.py