  
      # Use depth-wise convolution to calculate edge maps per channel.
      # Output tensor has shape [batch_size, h, w, d * num_kernels].
      pad_sizes = [[0, 0], [2, 2], [2, 2], [0, 0]]
      padded = tf.pad(image, pad_sizes, mode='REFLECT')
      output = K.depthwise_conv2d(padded, kernels)
  
      if not magnitude:  # direction of edges
          # Reshape to [batch_size, h, w, d, num_kernels].
          shape = K.concatenate([image_shape, num_kernels], axis=0)
 
</s> remove         output = tf.atan(K.squeeze(output[:, :, :, :, 0] / output[:, :, :, :, 1]))
    # magnitude of edges -- unified x & y edges don't work well with NN

 </s> add         output = tf.atan(K.squeeze(output[:, :, :, :, 0] / output[:, :, :, :, 1], axis=None))
    # magnitude of edges -- unified x & y edges don't work well with Neural Networks </s> remove     """
    Returns a tensor holding modified Scharr edge maps.
    Arguments:
    image: Image tensor with shape [batch_size, h, w, d] and type float32.
    The image(s) must be 2x2 or larger.
    magnitude: Boolean to determine if the edge magnitude or edge direction is returned
    Returns:
    Tensor holding edge maps for each channel. Returns a tensor with shape
    [batch_size, h, w, d, 2] where the last two dimensions hold [[dy[0], dx[0]],
    [dy[1], dx[1]], ..., [dy[d-1], dx[d-1]]] calculated using the Scharr filter.
 </s> add     """ Returns a tensor holding modified Scharr edge maps.

    Parameters
    ----------
    image: tensor
        Image tensor with shape [batch_size, h, w, d] and type float32. The image(s) must be 2x2
        or larger.
    magnitude: bool
        Boolean to determine if the edge magnitude or edge direction is returned

    Returns
    -------
    tensor
        Tensor holding edge maps for each channel. Returns a tensor with shape `[batch_size, h, w,
        d, 2]` where the last two dimensions hold `[[dy[0], dx[0]], [dy[1], dx[1]], ..., [dy[d-1],
        dx[d-1]]]` calculated using the Scharr filter. </s> remove     matrix = [[[[0.00070, 0.00070]],
               [[0.00520, 0.00370]],
               [[0.03700, 0.00000]],
               [[0.00520, -0.0037]],
               [[0.00070, -0.0007]]],
              [[[0.00370, 0.00520]],
               [[0.11870, 0.11870]],
               [[0.25890, 0.00000]],
               [[0.11870, -0.1187]],
               [[0.00370, -0.0052]]],
              [[[0.00000, 0.03700]],
               [[0.00000, 0.25890]],
               [[0.00000, 0.00000]],
               [[0.00000, -0.2589]],
               [[0.00000, -0.0370]]],
              [[[-0.0037, 0.00520]],
               [[-0.1187, 0.11870]],
               [[-0.2589, 0.00000]],
               [[-0.1187, -0.1187]],
               [[-0.0037, -0.0052]]],
              [[[-0.0007, 0.00070]],
               [[-0.0052, 0.00370]],
               [[-0.0370, 0.00000]],
               [[-0.0052, -0.0037]],
               [[-0.0007, -0.0007]]]]
 </s> add     matrix = np.array([[[[0.00070, 0.00070]],
                        [[0.00520, 0.00370]],
                        [[0.03700, 0.00000]],
                        [[0.00520, -0.0037]],
                        [[0.00070, -0.0007]]],
                       [[[0.00370, 0.00520]],
                        [[0.11870, 0.11870]],
                        [[0.25890, 0.00000]],
                        [[0.11870, -0.1187]],
                        [[0.00370, -0.0052]]],
                       [[[0.00000, 0.03700]],
                        [[0.00000, 0.25890]],
                        [[0.00000, 0.00000]],
                        [[0.00000, -0.2589]],
                        [[0.00000, -0.0370]]],
                       [[[-0.0037, 0.00520]],
                        [[-0.1187, 0.11870]],
                        [[-0.2589, 0.00000]],
                        [[-0.1187, -0.1187]],
                        [[-0.0037, -0.0052]]],
                       [[[-0.0007, 0.00070]],
                        [[-0.0052, 0.00370]],
                        [[-0.0370, 0.00000]],
                        [[-0.0052, -0.0037]],
                        [[-0.0007, -0.0007]]]]) </s> remove             rh, rw = self.size
            oh, ow = h * rh, w * rw
            oc = c // (rh * rw)
 </s> add             r_height, r_width = self.size
            o_height, o_width = height * r_height, width * r_width
            o_channels = channels // (r_height * r_width) </s> remove             batch_size, h, w, c = input_shape
 </s> add             batch_size, height, width, channels = input_shape
    padded = pad(image, pad_sizes, mode='REFLECT')
  
      # Use depth-wise convolution to calculate edge maps per channel.
      # Output tensor has shape [batch_size, h, w, d * num_kernels].
      pad_sizes = [[0, 0], [2, 2], [2, 2], [0, 0]]
    padded = pad(image, pad_sizes, mode='REFLECT')
      output = K.depthwise_conv2d(padded, kernels)
  
      if not magnitude:  # direction of edges
          # Reshape to [batch_size, h, w, d, num_kernels].
          shape = K.concatenate([image_shape, num_kernels], axis=0)
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