aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/ops/image_ops_impl.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/python/ops/image_ops_impl.py')
-rw-r--r--tensorflow/python/ops/image_ops_impl.py26
1 files changed, 3 insertions, 23 deletions
diff --git a/tensorflow/python/ops/image_ops_impl.py b/tensorflow/python/ops/image_ops_impl.py
index 2946dbe81e..b9c89d62d5 100644
--- a/tensorflow/python/ops/image_ops_impl.py
+++ b/tensorflow/python/ops/image_ops_impl.py
@@ -1119,9 +1119,8 @@ def rgb_to_grayscale(images, name=None):
# https://en.wikipedia.org/wiki/Luma_%28video%29
rgb_weights = [0.2989, 0.5870, 0.1140]
rank_1 = array_ops.expand_dims(array_ops.rank(images) - 1, 0)
- gray_float = math_ops.reduce_sum(flt_image * rgb_weights,
- rank_1,
- keep_dims=True)
+ gray_float = math_ops.reduce_sum(
+ flt_image * rgb_weights, rank_1, keepdims=True)
gray_float.set_shape(images.get_shape()[:-1].concatenate([1]))
return convert_image_dtype(gray_float, orig_dtype, name=name)
@@ -1212,26 +1211,7 @@ def adjust_hue(image, delta, name=None):
orig_dtype = image.dtype
flt_image = convert_image_dtype(image, dtypes.float32)
- # TODO(zhengxq): we will switch to the fused version after we add a GPU
- # kernel for that.
- fused = os.environ.get('TF_ADJUST_HUE_FUSED', '')
- fused = fused.lower() in ('true', 't', '1')
-
- if not fused:
- hsv = gen_image_ops.rgb_to_hsv(flt_image)
-
- hue = array_ops.slice(hsv, [0, 0, 0], [-1, -1, 1])
- saturation = array_ops.slice(hsv, [0, 0, 1], [-1, -1, 1])
- value = array_ops.slice(hsv, [0, 0, 2], [-1, -1, 1])
-
- # Note that we add 2*pi to guarantee that the resulting hue is a positive
- # floating point number since delta is [-0.5, 0.5].
- hue = math_ops.mod(hue + (delta + 1.), 1.)
-
- hsv_altered = array_ops.concat([hue, saturation, value], 2)
- rgb_altered = gen_image_ops.hsv_to_rgb(hsv_altered)
- else:
- rgb_altered = gen_image_ops.adjust_hue(flt_image, delta)
+ rgb_altered = gen_image_ops.adjust_hue(flt_image, delta)
return convert_image_dtype(rgb_altered, orig_dtype)