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 unsorted_segment_min to ivy functional API #17833

Merged
merged 3 commits into from
Jul 3, 2023

Conversation

akshatvishu
Copy link
Contributor

Close #17437

@ivy-leaves ivy-leaves added Array API Conform to the Array API Standard, created by The Consortium for Python Data API Standards Ivy API Experimental Run CI for testing API experimental/New feature or request PaddlePaddle Backend labels Jun 26, 2023
@zhumakhan
Copy link
Contributor

Hi, thanks for your PR! Please use with_unsupported_dtypes decorator instead of validating data types inside the function.

@akshatvishu
Copy link
Contributor Author

akshatvishu commented Jun 27, 2023

Hi, thanks for your PR! Please use with_unsupported_dtypes decorator instead of validating data types inside the function.

Hey @zhumakhan , thanks for the comment! Can you tell me how to use it for a particular argument ? Because num_segments and segment_ids can be only of int32/int64 regardless of the backend while the data can be float , int and at some backends unsigned_integers too is accepted as supported dtype.

@zhumakhan
Copy link
Contributor

zhumakhan commented Jun 27, 2023

Yeah, you are right, decorators check all inputs. Maybe you can try something like this: https://github.com/unifyai/ivy/blob/master/ivy/functional/ivy/general.py#L3163. If you look at its backend implementations they used (e.g. in torch backend) ivy.utils.assertions.check_gather_input_valid(params, indices, axis, batch_dims) to check inputs

@akshatvishu
Copy link
Contributor Author

Yeah, you are right, decorators check all inputs. Maybe you can try something like this: https://github.com/unifyai/ivy/blob/master/ivy/functional/ivy/general.py#L3163. If you look at its backend implementations they used (e.g. in torch backend) ivy.utils.assertions.check_gather_input_valid(params, indices, axis, batch_dims) to check inputs

Thank you for your insightful suggestion, @zhumakhan !! I found it very useful and have incorporated a similar approach into all backend implementations. I value your feedback, so please don't hesitate to share more suggestions or highlight any other areas where you think improvements could be made.😁

@zhumakhan
Copy link
Contributor

LGTM!

@zhumakhan zhumakhan merged commit c7b1c47 into ivy-llc:master Jul 3, 2023
@akshatvishu
Copy link
Contributor Author

LGTM!

Thanks Zuma for the review!

xoiga123 added a commit to xoiga123/ivy that referenced this pull request Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Array API Conform to the Array API Standard, created by The Consortium for Python Data API Standards Ivy API Experimental Run CI for testing API experimental/New feature or request Ivy Functional API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unsorted_segment_min
4 participants