Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added function paddle.vision.transforms.crop and test draft #21821

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b72acc8
added function paddle.vision.transforms.crop and test draft
danieldaug Aug 13, 2023
f0550d6
add optional get element function
root-yash Aug 14, 2023
7984976
lint
root-yash Aug 14, 2023
d732755
Merge branch 'main' of https://github.com/root-yash/ivy
root-yash Aug 14, 2023
ad94fe4
Merge pull request #1 from unifyai/main
root-yash Aug 14, 2023
631ac62
Merge branch 'unifyai:main' into master
root-yash Aug 14, 2023
e2e8e75
Merge branch 'unifyai:main' into master
danieldaug Aug 15, 2023
3603728
simplified crop function and fixed how to get values for crop paramet…
danieldaug Aug 15, 2023
0890d35
Merge branch 'unifyai:main' into master
danieldaug Aug 16, 2023
487067c
imported necessary information to use st.integers in test_paddle_crop
danieldaug Aug 16, 2023
c8fc16e
adjusting min and max values of parameters in test function to see if…
danieldaug Aug 16, 2023
86c3d27
Reverting accidental change to ivy.iml
danieldaug Aug 17, 2023
3a3e975
Reverting accidental change to misc.xml
danieldaug Aug 17, 2023
f22b36e
Reverting accidental changes to _template__of_py_test.xml
danieldaug Aug 17, 2023
3207528
fixed lint errors
danieldaug Aug 17, 2023
c04fd41
remove constraints
root-yash Aug 17, 2023
acf2326
Merge branch 'master' into main
root-yash Aug 17, 2023
194c1bb
Merge pull request #2 from root-yash/main
root-yash Aug 17, 2023
a3503a0
Merge branch 'unifyai:main' into master
root-yash Aug 17, 2023
647ba55
Merge branch 'main' into master
danieldaug Aug 17, 2023
05c0df8
reorganized code due to odd mix-up of different functions
danieldaug Aug 18, 2023
47934d1
Merge branch 'unifyai:main' into master
danieldaug Aug 18, 2023
356d133
fixed more lint errors after moving other function that was previousl…
danieldaug Aug 18, 2023
f2d50ee
lint error fix due to missing parenthesis
danieldaug Aug 18, 2023
d6ba582
reverted changes in .idea
danieldaug Aug 19, 2023
ce52174
Merge branch 'unifyai:main' into master
danieldaug Aug 19, 2023
3655e71
Merge branch 'unifyai:main' into master
root-yash Aug 19, 2023
564fa30
retrigger checks
root-yash Aug 19, 2023
fa05ec2
Merge branch 'unifyai:main' into master
root-yash Aug 21, 2023
d511aec
Add support for lists in `optional_get_element`
KareemMAX Aug 21, 2023
e914c70
Merge branch 'unifyai:master' into master
danieldaug Aug 22, 2023
e8d2df9
moved line importing strategies as st into global section
danieldaug Aug 22, 2023
57cfe5a
Merge branch 'unifyai:main' into master
danieldaug Aug 23, 2023
ea7494f
attempting to fix line formatting for lint black error
danieldaug Aug 23, 2023
eb00d5b
Merge branch 'unifyai:main' into master
danieldaug Aug 24, 2023
df087c3
Merge branch 'unifyai:main' into master
danieldaug Aug 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ivy/functional/frontends/paddle/vision/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,19 @@ def vflip(img, data_format="CHW"):
return ivy.flip(img, axis=axis)

danieldaug marked this conversation as resolved.
Show resolved Hide resolved

@with_unsupported_device_and_dtypes(
{"2.5.1 and below": ("float16", "float32", "int16", "int8", "uint8")}, "paddle"
)
@to_ivy_arrays_and_back
def crop(img, top, left, height, width):
return img[top : top + height, left : left + width]


@with_supported_dtypes(
{"2.5.1 and below": ("float32", "float64", "int32", "int64")}, "paddle"
)
@to_ivy_arrays_and_back
def hflip(img):
img = ivy.array(img)
return ivy.flip(img, axis=-1)

danieldaug marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# local
danieldaug marked this conversation as resolved.
Show resolved Hide resolved
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test

from hypothesis import strategies as st

# to_tensor
@handle_frontend_test(
Expand Down Expand Up @@ -87,6 +87,7 @@ def test_paddle_vflip(
test_flags,
backend_fw,
):

danieldaug marked this conversation as resolved.
Show resolved Hide resolved
input_dtype, x = dtype_and_x
helpers.test_frontend_function(
input_dtypes=input_dtype,
Expand All @@ -99,6 +100,47 @@ def test_paddle_vflip(
)


@handle_frontend_test(
fn_tree="paddle.vision.transforms.crop",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("valid"),
num_arrays=1,
min_dim_size=2,
max_dim_size=100,
),
danieldaug marked this conversation as resolved.
Show resolved Hide resolved
top=st.integers(min_value=0, max_value=100),
left=st.integers(min_value=0, max_value=100),
height=st.integers(min_value=0, max_value=100),
width=st.integers(min_value=0, max_value=100),
)
def test_paddle_crop(
*,
dtype_and_x,
top,
left,
height,
width,
on_device,
fn_tree,
frontend,
test_flags,
backend_fw,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_function(
input_dtypes=input_dtype,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
img=x[0],
top=top,
left=left,
height=height,
width=width,
backend_to_test=backend_fw,
)

# hflip
@handle_frontend_test(
fn_tree="paddle.vision.transforms.hflip",
Expand Down
Loading