From 68b845a35a4ffeb1d8e3f0d59c5ef7dd337c8ce4 Mon Sep 17 00:00:00 2001 From: xPushpeshx Date: Wed, 16 Aug 2023 22:45:19 +0530 Subject: [PATCH 1/6] fixed: Bigs1 --- .../backends/paddle/experimental/layers.py | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/ivy/functional/backends/paddle/experimental/layers.py b/ivy/functional/backends/paddle/experimental/layers.py index fafd86275beb3..f3f2dcdd6ab37 100644 --- a/ivy/functional/backends/paddle/experimental/layers.py +++ b/ivy/functional/backends/paddle/experimental/layers.py @@ -438,7 +438,33 @@ def interpolate( antialias: Optional[bool] = False, out: Optional[paddle.Tensor] = None, ): - raise IvyNotImplementedException() + if mode == "linear": + interpolation_method = "linear" + elif mode == "bilinear": + interpolation_method = "bilinear" + elif mode == "trilinear": + interpolation_method = "trilinear" + else: + raise ValueError("Invalid interpolation mode") + + if scale_factor is not None: + if isinstance(scale_factor, int): + scale_factor = (scale_factor, ) * len(size) + elif isinstance(scale_factor, tuple): + scale_factor = scale_factor + else: + raise ValueError("Invalid scale_factor type") + + if recompute_scale_factor is not None: + raise ValueError("recompute_scale_factor is not supported in paddle backend") + + if align_corners == None: + align_corners = False + + if antialias is not None: + raise ValueError("antialias is not supported in paddle backend") + + return paddle.nn.functional.interpolate(x, size, mode=interpolation_method, align_corners=align_corners, scale_factor=scale_factor) def adaptive_max_pool2d( From 3d3d920505d209529bf06306fd196bfe11840431 Mon Sep 17 00:00:00 2001 From: xPushpeshx Date: Wed, 16 Aug 2023 23:19:14 +0530 Subject: [PATCH 2/6] fixed: Bugs2 --- ivy/functional/backends/paddle/experimental/layers.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ivy/functional/backends/paddle/experimental/layers.py b/ivy/functional/backends/paddle/experimental/layers.py index f3f2dcdd6ab37..5494077ba9ad7 100644 --- a/ivy/functional/backends/paddle/experimental/layers.py +++ b/ivy/functional/backends/paddle/experimental/layers.py @@ -449,7 +449,7 @@ def interpolate( if scale_factor is not None: if isinstance(scale_factor, int): - scale_factor = (scale_factor, ) * len(size) + scale_factor = (scale_factor,) * len(size) elif isinstance(scale_factor, tuple): scale_factor = scale_factor else: @@ -458,13 +458,18 @@ def interpolate( if recompute_scale_factor is not None: raise ValueError("recompute_scale_factor is not supported in paddle backend") - if align_corners == None: + if align_corners is None: align_corners = False if antialias is not None: raise ValueError("antialias is not supported in paddle backend") - return paddle.nn.functional.interpolate(x, size, mode=interpolation_method, align_corners=align_corners, scale_factor=scale_factor) + return paddle.nn.functional.interpolate(x, + size, + mode=interpolation_method, + align_corners=align_corners, + scale_factor=scale_factor + ) def adaptive_max_pool2d( From 6cb2d0a890c977a6dfb1b57ac20f49fb2c5db67d Mon Sep 17 00:00:00 2001 From: xPushpeshx Date: Wed, 16 Aug 2023 23:59:20 +0530 Subject: [PATCH 3/6] fixed: Bugs3 --- ivy/functional/backends/paddle/experimental/layers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ivy/functional/backends/paddle/experimental/layers.py b/ivy/functional/backends/paddle/experimental/layers.py index 5494077ba9ad7..910e45f0eb8bf 100644 --- a/ivy/functional/backends/paddle/experimental/layers.py +++ b/ivy/functional/backends/paddle/experimental/layers.py @@ -465,10 +465,10 @@ def interpolate( raise ValueError("antialias is not supported in paddle backend") return paddle.nn.functional.interpolate(x, - size, - mode=interpolation_method, - align_corners=align_corners, - scale_factor=scale_factor + size, + mode=interpolation_method, + align_corners=align_corners, + scale_factor=scale_factor ) From 97cfcb15860b71ba8528f8963a7f11e5e6a4711f Mon Sep 17 00:00:00 2001 From: xPushpeshx Date: Thu, 17 Aug 2023 00:01:03 +0530 Subject: [PATCH 4/6] fixed: Bugs4 --- ivy/functional/backends/paddle/experimental/layers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ivy/functional/backends/paddle/experimental/layers.py b/ivy/functional/backends/paddle/experimental/layers.py index 910e45f0eb8bf..b9fd423da4117 100644 --- a/ivy/functional/backends/paddle/experimental/layers.py +++ b/ivy/functional/backends/paddle/experimental/layers.py @@ -468,7 +468,7 @@ def interpolate( size, mode=interpolation_method, align_corners=align_corners, - scale_factor=scale_factor + scale_factor=scale_factor, ) From 296762d9212f832f0b1b717d23f4b7559a897164 Mon Sep 17 00:00:00 2001 From: xPushpeshx Date: Thu, 17 Aug 2023 00:01:36 +0530 Subject: [PATCH 5/6] fixed: Bugs5 --- ivy/functional/backends/paddle/experimental/layers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ivy/functional/backends/paddle/experimental/layers.py b/ivy/functional/backends/paddle/experimental/layers.py index b9fd423da4117..9d221b1b72fed 100644 --- a/ivy/functional/backends/paddle/experimental/layers.py +++ b/ivy/functional/backends/paddle/experimental/layers.py @@ -464,7 +464,8 @@ def interpolate( if antialias is not None: raise ValueError("antialias is not supported in paddle backend") - return paddle.nn.functional.interpolate(x, + return paddle.nn.functional.interpolate( + x, size, mode=interpolation_method, align_corners=align_corners, From ab75732c972f6c357e8afc4d0a4e0dd86c505a8c Mon Sep 17 00:00:00 2001 From: xPushpeshx Date: Thu, 17 Aug 2023 00:07:20 +0530 Subject: [PATCH 6/6] fixed: Bugs6 --- ivy/functional/backends/paddle/experimental/layers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ivy/functional/backends/paddle/experimental/layers.py b/ivy/functional/backends/paddle/experimental/layers.py index 9d221b1b72fed..e0efa41dd1af6 100644 --- a/ivy/functional/backends/paddle/experimental/layers.py +++ b/ivy/functional/backends/paddle/experimental/layers.py @@ -446,7 +446,7 @@ def interpolate( interpolation_method = "trilinear" else: raise ValueError("Invalid interpolation mode") - + if scale_factor is not None: if isinstance(scale_factor, int): scale_factor = (scale_factor,) * len(size) @@ -454,13 +454,13 @@ def interpolate( scale_factor = scale_factor else: raise ValueError("Invalid scale_factor type") - + if recompute_scale_factor is not None: raise ValueError("recompute_scale_factor is not supported in paddle backend") - + if align_corners is None: align_corners = False - + if antialias is not None: raise ValueError("antialias is not supported in paddle backend")