              Returns:
              A pair containing the luminance measure, and the contrast-structure measure.
              """
  
              def reducer(var_x, kernel):
                  shape = tf.shape(var_x)
                  var_x = tf.reshape(var_x, shape=tf.concat([[-1], shape[-3:]], 0))
                  var_y = tf.nn.depthwise_conv2d(var_x, kernel, strides=[1, 1, 1, 1], padding='VALID')
                  return tf.reshape(var_y, tf.concat([shape[:-3], tf.shape(var_y)[1:]], 0))
  
              _ssim_k1 = 0.01
              _ssim_k2 = 0.03
  
              c_1 = (_ssim_k1 * max_val) ** 2
 
</s> remove             _ssim_k1 = 0.01
            _ssim_k2 = 0.03

            c_1 = (_ssim_k1 * max_val) ** 2
            c_2 = (_ssim_k2 * max_val) ** 2
 </s> add             c_one = (0.01 * max_val) ** 2
            c_two = ((0.03 * max_val)) ** 2 * compensation </s> remove             # (2 * mu_x * mu_y + c_1) / (mu_x ** 2 + mu_y ** 2 + c_1).
            mean0 = reducer(var_x, kernel)
            mean1 = reducer(var_y, kernel)
            num0 = mean0 * mean1 * 2.0
 </s> add             # (2 * mu_x * mu_y + c_one) / (mu_x ** 2 + mu_y ** 2 + c_one).
            mean0 = reducer(img1, kernel)
            mean1 = reducer(img2, kernel)
            num0 = mean0 * mean1 * 2. </s> remove             luminance = (num0 + c_1) / (den0 + c_1)
 </s> add             luminance = (num0 + c_one) / (den0 + c_one) </s> remove                                  lambda: do_pad(flat_imgs, remainder),
                                 lambda: flat_imgs)
 </s> add                                  lambda: do_pad(flat_imgs, remainder), lambda: flat_imgs) </s> remove                 imgs = [tf.reshape(x, tf.concat([h, t], 0))
                        for x, h, t in zip(downscaled, heads, tails)]
 </s> add                 zipper = zip(downscaled, heads, tails)
                imgs = [tf.reshape(x, tf.concat([h, t], 0)) for x, h, t in zipper]
            def reducer(img1, kernel):
                shape = tf.shape(img1)
                img1 = tf.reshape(img1, shape=tf.concat([[-1], shape[-3:]], 0))
                img2 = tf.nn.depthwise_conv2d(img1, kernel, strides=[1, 1, 1, 1], padding='VALID')
                return tf.reshape(img2, tf.concat([shape[:-3], tf.shape(img2)[1:]], 0))
              Returns:
              A pair containing the luminance measure, and the contrast-structure measure.
              """
  
            def reducer(img1, kernel):
                shape = tf.shape(img1)
                img1 = tf.reshape(img1, shape=tf.concat([[-1], shape[-3:]], 0))
                img2 = tf.nn.depthwise_conv2d(img1, kernel, strides=[1, 1, 1, 1], padding='VALID')
                return tf.reshape(img2, tf.concat([shape[:-3], tf.shape(img2)[1:]], 0))
            def reducer(img1, kernel):
                shape = tf.shape(img1)
                img1 = tf.reshape(img1, shape=tf.concat([[-1], shape[-3:]], 0))
                img2 = tf.nn.depthwise_conv2d(img1, kernel, strides=[1, 1, 1, 1], padding='VALID')
                return tf.reshape(img2, tf.concat([shape[:-3], tf.shape(img2)[1:]], 0))
            def reducer(img1, kernel):
                shape = tf.shape(img1)
                img1 = tf.reshape(img1, shape=tf.concat([[-1], shape[-3:]], 0))
                img2 = tf.nn.depthwise_conv2d(img1, kernel, strides=[1, 1, 1, 1], padding='VALID')
                return tf.reshape(img2, tf.concat([shape[:-3], tf.shape(img2)[1:]], 0))
            def reducer(img1, kernel):
                shape = tf.shape(img1)
                img1 = tf.reshape(img1, shape=tf.concat([[-1], shape[-3:]], 0))
                img2 = tf.nn.depthwise_conv2d(img1, kernel, strides=[1, 1, 1, 1], padding='VALID')
                return tf.reshape(img2, tf.concat([shape[:-3], tf.shape(img2)[1:]], 0))
            def reducer(img1, kernel):
                shape = tf.shape(img1)
                img1 = tf.reshape(img1, shape=tf.concat([[-1], shape[-3:]], 0))
                img2 = tf.nn.depthwise_conv2d(img1, kernel, strides=[1, 1, 1, 1], padding='VALID')
                return tf.reshape(img2, tf.concat([shape[:-3], tf.shape(img2)[1:]], 0))
  
              _ssim_k1 = 0.01
              _ssim_k2 = 0.03
  
              c_1 = (_ssim_k1 * max_val) ** 2
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
 documentation, pep8, style, clarity updates  - Prep for Segmentation (#812)

* documentation, pep8, style, clarity updates

* Update cli.py

* Update _config.py

remove extra mask and coverage

mask type as dropdown

* Update training_data.py

move coverage / LR to global
cut down on loss description

style change
losses working in PR

* simpler logging

* legacy update 
lib/model/losses.py