Skip to content

Commit

Permalink
🤖 Lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-branch committed Oct 25, 2023
1 parent 45d70f2 commit 7e9e762
Showing 1 changed file with 47 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ def _reshape_helper(draw):
return dtypes, x, reshape_shape


# diagonal
@st.composite
def dims_and_offset(draw, shape):
shape_actual = draw(shape)
dim1 = draw(helpers.get_axis(shape=shape, force_int=True))
dim2 = draw(helpers.get_axis(shape=shape, force_int=True))
offset = draw(
st.integers(min_value=-shape_actual[dim1], max_value=shape_actual[dim1])
)
return dim1, dim2, offset


# expand helper function
@st.composite
def dtypes_x_shape(draw):
Expand Down Expand Up @@ -254,18 +266,6 @@ def dtypes_x_shape(draw):
return dtypes, x, shape


# diagonal
@st.composite
def dims_and_offset(draw, shape):
shape_actual = draw(shape)
dim1 = draw(helpers.get_axis(shape=shape, force_int=True))
dim2 = draw(helpers.get_axis(shape=shape, force_int=True))
offset = draw(
st.integers(min_value=-shape_actual[dim1], max_value=shape_actual[dim1])
)
return dim1, dim2, offset


# --- Main --- #
# ------------ #

Expand Down Expand Up @@ -2180,41 +2180,6 @@ def test_paddle_exp_(
)


# expand
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="expand",
dtype_x_shape=dtypes_x_shape(),
)
def test_paddle_tensor_expand(
dtype_x_shape,
frontend_method_data,
init_flags,
method_flags,
frontend,
on_device,
backend_fw,
):
input_dtype, x, shape = dtype_x_shape
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
backend_to_test=backend_fw,
init_all_as_kwargs_np={
"data": x[0],
},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={
"shape": shape,
},
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
frontend=frontend,
on_device=on_device,
)


# fill_
@handle_frontend_method(
class_tree=CLASS_TREE,
Expand Down Expand Up @@ -4609,6 +4574,41 @@ def test_paddle_tanh_(
)


# expand
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="expand",
dtype_x_shape=dtypes_x_shape(),
)
def test_paddle_tensor_expand(
dtype_x_shape,
frontend_method_data,
init_flags,
method_flags,
frontend,
on_device,
backend_fw,
):
input_dtype, x, shape = dtype_x_shape
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
backend_to_test=backend_fw,
init_all_as_kwargs_np={
"data": x[0],
},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={
"shape": shape,
},
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
frontend=frontend,
on_device=on_device,
)


# tile
@handle_frontend_method(
class_tree=CLASS_TREE,
Expand Down

0 comments on commit 7e9e762

Please sign in to comment.