diff --git a/tensorflow/python/keras/preprocessing/image.py b/tensorflow/python/keras/preprocessing/image.py index 3af573fa036..aa4801504cc 100644 --- a/tensorflow/python/keras/preprocessing/image.py +++ b/tensorflow/python/keras/preprocessing/image.py @@ -49,6 +49,7 @@ random_brightness = image.random_brightness apply_affine_transform = image.apply_affine_transform +@keras_export('keras.preprocessing.image.smart_resize', v1=[]) def smart_resize(x, size, interpolation='bilinear'): """Resize images to a target size without aspect ratio distortion. @@ -65,7 +66,7 @@ def smart_resize(x, size, interpolation='bilinear'): ``` However, if you do this, you distort the aspect ratio of your images, since - in general they do not all have the same aspect ratio. This is + in general they do not all have the same aspect ratio as `size`. This is fine in many cases, but not always (e.g. for GANs this can be a problem). Note that passing the argument `preserve_aspect_ratio=True` to `resize` diff --git a/tensorflow/tools/api/golden/v2/tensorflow.keras.preprocessing.image.pbtxt b/tensorflow/tools/api/golden/v2/tensorflow.keras.preprocessing.image.pbtxt index 0b49aa9f3d4..e59c78cc496 100644 --- a/tensorflow/tools/api/golden/v2/tensorflow.keras.preprocessing.image.pbtxt +++ b/tensorflow/tools/api/golden/v2/tensorflow.keras.preprocessing.image.pbtxt @@ -68,4 +68,8 @@ tf_module { name: "save_img" argspec: "args=[\'path\', \'x\', \'data_format\', \'file_format\', \'scale\'], varargs=None, keywords=kwargs, defaults=[\'None\', \'None\', \'True\'], " } + member_method { + name: "smart_resize" + argspec: "args=[\'x\', \'size\', \'interpolation\'], varargs=None, keywords=None, defaults=[\'bilinear\'], " + } }