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 frontend for mindspore.ops.hardswish #21275

Merged
merged 6 commits into from
Aug 20, 2023
Merged
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
19 changes: 19 additions & 0 deletions ivy/functional/frontends/mindspore/ops/function/nn_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ def softsign(x):
return ivy.divide(x, ivy.add(1, ivy.abs(x)))


@with_supported_dtypes(
{
"2.0 and below": (
"int8",
"int16",
"int32",
"int64",
"float16",
"float32",
"float64",
)
Comment on lines +43 to +51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I haven't noticed this before in the earlier review, but where did you find this info? It sounds correct but I can't seem to find it anywhere in their docs or code...

Copy link
Contributor Author

@jindalai jindalai Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation

In the documentation it says :

Raises
Type Error– If dtype of x is not int or float

So I inferred from that to use all possible int and float that mindspore supports (just like numpy)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please let me know of any further requirements 😄

},
"mindspore",
)
@to_ivy_arrays_and_back
def hardswish(x):
return ivy.hardswish(x)


@with_supported_dtypes(
{
"2.0 and below": (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,32 @@
# )


# hardswish
# @handle_frontend_test(
# fn_tree="mindspore.ops.function.nn_func.hardswish",
# dtype_and_x=helpers.dtype_and_values(
# available_dtypes=helpers.get_dtypes("valid"),
# ),
# )
# def test_mindspore_hardswish(
# *,
# dtype_and_x,
# on_device,
# fn_tree,
# frontend,
# test_flags,
# ):
# 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,
# x=x[0],
# )


# pad
# @handle_frontend_test(
# fn_tree="pad",
Expand Down
Loading