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 relu_ to torch frontend and tested #6033

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def _selu_with_inplace(input, inplace=False):
return ret


def relu_(input):
ret = ivy.maximum(0, input)
ivy.inplace_update(input, ret)
return input


def _rrelu(input, lower=1.0 / 8, upper=1.0 / 3, training=False, inplace=False):
if training:
# alpha = ivy.random_uniform(low=lower, high=upper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,40 @@ def test_torch_softmax(
)


# relu_
@handle_cmd_line_args
@given(
dtype_and_input=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("numeric"),
),
num_positional_args=helpers.num_positional_args(
fn_name="ivy.functional.frontends.torch.relu_"
),
with_inplace=st.booleans(),
)
def test_torch_relu_(
dtype_and_input,
with_inplace,
as_variable,
num_positional_args,
native_array,
):
input_dtype, input = dtype_and_input
_filter_dtypes(input_dtype)
helpers.test_frontend_function(
input_dtypes=input_dtype,
as_variable_flags=as_variable,
with_out=False,
with_inplace=with_inplace,
num_positional_args=num_positional_args,
native_array_flags=native_array,
frontend="torch",
fn_tree="nn.functional.relu_",
test_values=False,
input=input[0],
)


# gelu
@handle_cmd_line_args
@given(
Expand Down