def blend(image1, image2, factor):
    'Blend image1 and image2 using \'factor\'.\n\n  Factor can be above 0.0.  A value of 0.0 means only image1 is used.\n  A value of 1.0 means only image2 is used.  A value between 0.0 and\n  1.0 means we linearly interpolate the pixel values between the two\n  images.  A value greater than 1.0 "extrapolates" the difference\n  between the two pixel values, and we clip the results to values\n  between 0 and 255.\n\n  Args:\n    image1: An image Tensor of type uint8.\n    image2: An image Tensor of type uint8.\n    factor: A floating point value above 0.0.\n\n  Returns:\n    A blended image Tensor of type uint8.\n  '
    if (factor == 0.0):
        return tf.convert_to_tensor(image1)
    if (factor == 1.0):
        return tf.convert_to_tensor(image2)
    image1 = tf.to_float(image1)
    image2 = tf.to_float(image2)
    difference = (image2 - image1)
    scaled = (factor * difference)
    temp = (tf.to_float(image1) + scaled)
    if ((factor > 0.0) and (factor < 1.0)):
        return tf.cast(temp, tf.uint8)
    return tf.cast(tf.clip_by_value(temp, 0.0, 255.0), tf.uint8)
Blend image1 and image2 using 'factor'.

Factor can be above 0.0.  A value of 0.0 means only image1 is used.
A value of 1.0 means only image2 is used.  A value between 0.0 and
1.0 means we linearly interpolate the pixel values between the two
images.  A value greater than 1.0 "extrapolates" the difference
between the two pixel values, and we clip the results to values
between 0 and 255.

Args:
  image1: An image Tensor of type uint8.
  image2: An image Tensor of type uint8.
  factor: A floating point value above 0.0.

Returns:
  A blended image Tensor of type uint8.
def blend(image1, image2, factor):
    'Blend image1 and image2 using \'factor\'.\n\n  Factor can be above 0.0.  A value of 0.0 means only image1 is used.\n  A value of 1.0 means only image2 is used.  A value between 0.0 and\n  1.0 means we linearly interpolate the pixel values between the two\n  images.  A value greater than 1.0 "extrapolates" the difference\n  between the two pixel values, and we clip the results to values\n  between 0 and 255.\n\n  Args:\n    image1: An image Tensor of type uint8.\n    image2: An image Tensor of type uint8.\n    factor: A floating point value above 0.0.\n\n  Returns:\n    A blended image Tensor of type uint8.\n  '
    if (factor == 0.0):
        return tf.convert_to_tensor(image1)
    if (factor == 1.0):
        return tf.convert_to_tensor(image2)
    image1 = tf.to_float(image1)
    image2 = tf.to_float(image2)
    difference = (image2 - image1)
    scaled = (factor * difference)
    temp = (tf.to_float(image1) + scaled)
    if ((factor > 0.0) and (factor < 1.0)):
        return tf.cast(temp, tf.uint8)
    return tf.cast(tf.clip_by_value(temp, 0.0, 255.0), tf.uint8)