diff --git a/ivy/functional/frontends/paddle/vision/transforms.py b/ivy/functional/frontends/paddle/vision/transforms.py index 179262ce444a9..4ef1ee5137689 100644 --- a/ivy/functional/frontends/paddle/vision/transforms.py +++ b/ivy/functional/frontends/paddle/vision/transforms.py @@ -170,6 +170,21 @@ def normalize(img, mean, std, data_format="CHW", to_rgb=False): raise ValueError("Unsupported input format") +@with_supported_dtypes({"2.5.1 and below": ("float32", "float64", "uint8")}, "paddle") +@to_ivy_arrays_and_back +def resize(img, size, interpolation="bilinear"): + if ivy.is_array(img): + # Get the height and width of the original image + orig_height, orig_width = img.shape[-3], img.shape[-2] + + # Resize the image using Ivy's resize function + img_resized = ivy.resize(img, (orig_height * size[0], orig_width * size[1])) + + return img_resized + else: + raise ValueError("Unsupported input format") + + @with_supported_dtypes( {"2.5.1 and below": ("float32", "float64", "int32", "int64")}, "paddle" ) diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_vision/test_transforms.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_vision/test_transforms.py index 998fba32ad3fb..5016180d19ac4 100644 --- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_vision/test_transforms.py +++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_vision/test_transforms.py @@ -181,3 +181,34 @@ def test_paddle_vflip( img=x[0], backend_to_test=backend_fw, ) + + +@handle_frontend_test( + fn_tree="paddle.vision.transforms.resize", + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("valid"), + shape=_chw_image_shape_helper(), + ), + size=helpers.ints(min_value=1, max_value=100), +) +def test_paddle_resize( + *, + dtype_and_x, + size, + on_device, + fn_tree, + frontend, + test_flags, + backend_fw, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_function( + input_dtypes=input_dtype, + backend_to_test=backend_fw, + frontend=frontend, + test_flags=test_flags, + fn_tree=fn_tree, + on_device=on_device, + img=x[0], + size=(size, size), + )