Skip to content

Commit

Permalink
refractored ivy-test nested-map (ivy-llc#23186)
Browse files Browse the repository at this point in the history
  • Loading branch information
Killua7362 authored Sep 7, 2023
1 parent 7bdb325 commit 39d2810
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions ivy_tests/test_ivy/helpers/function_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ def test_frontend_function(

if not test_values:
ret = ivy_backend.nested_map(
ret, _frontend_array_to_ivy, include_derived={tuple: True}
ret, _frontend_array_to_ivy, include_derived={"tuple": True}
)

def arrays_to_numpy(x):
Expand Down Expand Up @@ -2377,7 +2377,7 @@ def map_fn(x):
return ivy_backend.to_ivy(x)
return x

ret = ivy_backend.nested_map(ret, map_fn, include_derived={tuple: True})
ret = ivy_backend.nested_map(ret, map_fn, include_derived={"tuple": True})
return ret, flatten_and_to_np(backend=backend_to_test, ret=ret)


Expand All @@ -2397,24 +2397,24 @@ def get_frontend_ret(
with BackendHandler.update_backend(backend) as ivy_backend:
if not as_ivy_arrays and test_compile:
args, kwargs = ivy_backend.nested_map(
(args, kwargs), _frontend_array_to_ivy, include_derived={tuple: True}
(args, kwargs), _frontend_array_to_ivy, include_derived={"tuple": True}
)
with ivy_backend.PreciseMode(precision_mode):
ret = frontend_fn(*args, **kwargs)
if test_compile and frontend_array_function is not None:
if as_ivy_arrays:
ret = ivy_backend.nested_map(
ret, ivy_backend.asarray, include_derived={tuple: True}
ret, ivy_backend.asarray, include_derived={"tuple": True}
)
else:
ret = ivy_backend.nested_map(
ret,
arrays_to_frontend(backend, frontend_array_function),
include_derived={tuple: True},
include_derived={"tuple": True},
)
elif as_ivy_arrays:
ret = ivy_backend.nested_map(
ret, _frontend_array_to_ivy, include_derived={tuple: True}
ret, _frontend_array_to_ivy, include_derived={"tuple": True}
)
return ret

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _pow_helper_shared_dtype(draw):
dtype1, dtype2 = dtype
x1, x2 = x
if "int" in dtype2:
x2 = ivy.nested_map(x2, lambda x: abs(x), include_derived={list: True})
x2 = ivy.nested_map(x2, lambda x: abs(x), include_derived={"list": True})

if ivy.is_int_dtype(dtype2):
max_val = ivy.iinfo(dtype2).max
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def cast_filter(dtype1_x1_dtype2):
dtype2 = dtype2[0]
if "int" in dtype2:
x2 = ivy.nested_map(
x2[0], lambda x: abs(x), include_derived={list: True}, shallow=False
x2[0], lambda x: abs(x), include_derived={"list": True}, shallow=False
)
return [dtype1, dtype2], [x1, x2]

Expand Down

0 comments on commit 39d2810

Please sign in to comment.